4

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.

COil
  • 7,201
  • 2
  • 50
  • 98

1 Answers1

4

You can add option "repository_method" If you want to specify the repository method to use to find the entity

 * @ParamConverter("center", converter="propel", class="MyCompany\Bundle\CoreBundle\Model\Center", options={"repository_method" = "findByCustomQuery"})
Abdallah Arffak
  • 1,193
  • 6
  • 13
  • Juts tester and unfortunately this option doesn't seem to be supported by Propel but only by Doctrine. – COil Dec 23 '14 at 09:11
  • Oki, do you mean by propel 1.7 => propel 1.1.7, because version 1.7 doesn't exist – Abdallah Arffak Dec 23 '14 at 15:07
  • I think this can´t be done without modifying the code. Looking for the snippet. – COil Dec 25 '14 at 10:04
  • 1
    Exactly, I just made a pull request https://github.com/arffak/PropelBundle/commit/1c7e6ccdc643b566fad7fe8d07fd06b4b4960645 – Abdallah Arffak Dec 25 '14 at 15:17
  • 1
    with this mofication you can use "query_method" option ==> @ParamConverter("center", converter="propel", class="MyCompany\Bundle\CoreBundle\Model\Center", options={"query_method" = "findByCustomQuery"}) – Abdallah Arffak Dec 25 '14 at 15:18
  • Excellent, I'll have a look next week see you. – COil Dec 25 '14 at 20:48