I am trying to follow the Symfony2 cookbook tutorial for loading users from a DB.
The tutorial assumes you have a ACME/UserBundle and my installation doesn’t, but I just assumed I could make my own (it’s not like a plugin-packade I need to download somewhere right?).
I created a bundle UserBundle and copy-pasted the code from the tutorial’s entity User (first code box here).
This line seems to break things for me:
@ORM\Entity(repositoryClass="Mycompany\UserBundle\Entity\UserRepository")
The error message I get is:
Fatal error: Class 'mycompany\UserBundle\Entity\UserRepository' not
found in /var/www/mycompany/vendor/doctrine/lib/Doctrine/ORM/EntityManager.php
on line 578
So I either assume I couldn’t just create my own UserBundle (strange since I thought this was a tutorial on how to do it, not how to install a plugin that does it), or they assumed I knew that I somehow needed to register the entity among entityRepositories somehow?
I will be most grateful if anyone more senior in symfony would enlighten me on this. I truly love all that I have learned about Symfony2 so far, but I am a bit of a slow learner here.
It sounds like you dont have a user repository class, this is seperate to the user entity class. It goes in the entity folder but would be UserRepository.php and look something like:
This class is available futher down the tutorial you are doing http://symfony.com/doc/current/cookbook/security/entity_provider.html