简体   繁体   中英

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

I am using a Propel parameter converter in one of my controller: ( Symfony 2.4.2 + Propel 1.7 )

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

It's work well, but I'd like to add additional filters, typically a on a field isVisible (but the filter may be more complex), it is possible? In fact, what I'd like is to use a custom query function of my model and not the basic findPk() function.

您可以添加选项“repository_method”如果要指定用于查找实体的存储库方法

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM