It's not a problem of location of the repository class but a problem
of configuration.

Your problem is that getRepository() is returning a default Doctrine
\ORM\EntityRepository class (which only contains find, findBy,
findAll) and not the custom one you created.
You have to explicitly tell what is the repository class of an
entity,

with XML config, on Ressources/config/doctrine/metadata/orm/
Test.dcm.xml
<entity name="Application\HelloBundle\Entity\Test" repository-
class="Application\HelloBundle\Entity\TestRepository">
 ....
</enty>

The same can be done with doc block annotations on the entity class
but as the syntax has changed I'm not sure that the doc is already up-
to-date.

On 19 jan, 07:28, 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-wit...
> Can anyone please tell me how to create and use custom and complex
> queries in sf2? Maybe repositories files are not proper place?
>
> Regards

-- 
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

Reply via email to