Symfony2 and Propel bundle: add an additional filter to the Propel param converter

I use the Propel parameter converter in one of my controllers: ( Symfony 2.4.2 + Propel 1.7 )

 * @ParamConverter("center", converter="propel", class="MyCompany\Bundle\CoreBundle\Model\Center")

It works well, but I would like to add additional filters, usually in the field isVisible(but the filter may be more complex), is this possible? In fact, I would like to use the custom query function of my model, not the base function findPk().

+4
source share
1 answer

You can add the option "repository_method". If you want to specify a repository method to search for an object

 * @ParamConverter("center", converter="propel", class="MyCompany\Bundle\CoreBundle\Model\Center", options={"repository_method" = "findByCustomQuery"})
+4

Source: https://habr.com/ru/post/1528055/


All Articles