On Wed, 19 Jan 2011 05:28:37 -0800 (PST), Venzon <[email protected]> wrote: > I have problem creating custom getters inside my entity repository > class. > When I call my getter from controller: > > $qb = $this->get('doctrine.orm.entity_manager') > ->getRepository('HelloBundle:Test') > ->getCustomResults(); > > I get error: > > [...]The method name must start with either findBy or findOneBy! > > All magic getters (findBy, findOneBy...) work for me tho. > Example from doctrine page is not working: > http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#custom-repositories > Can anyone please tell me how to create and use custom and complex > queries in sf2? Maybe repositories files are not proper place? > > Regards
The only constraint about the repository class is that you have to give its fully qualified class name in the entity mapping. Your problem is that the repository returned by getRepository does not have the getCustomResults method so it uses __call (used to handle magically the findBy* and findOneBy* methods). You should check the class of the repository to be sure you get your custom repository instead of the default one. Regards -- Christophe | Stof -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
