我在我的一个 Controller 中使用 Propel 参数转换器:(Symfony 2.4.2 + Propel 1.7)
* @ParamConverter("center", converter="propel", class="MyCompany\Bundle\CoreBundle\Model\Center")
它运行良好,但我想添加额外的过滤器,通常是在字段 isVisible
上(但过滤器可能更复杂),这可能吗?事实上,我想要的是使用我的模型的自定义查询函数,而不是基本的 findPk()
函数。
最佳答案
如果你想指定用于查找实体的存储库方法,你可以添加选项“repository_method”
* @ParamConverter("center", converter="propel", class="MyCompany\Bundle\CoreBundle\Model\Center", options={"repository_method" = "findByCustomQuery"})
关于php - Symfony2 和 Propel 包 : add additional filter to the Propel param converter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21929290/