Im using the FOSUserBundle in symfony2, it's works very well but I have to create for example another table like Entry, with fields:
user_id, description,...
I need to make a relationship between the user
table and Entry
table. What is the best way to make the relationship One to Many? Which class I should extend?
I get this error:
Entry has no association named ApplicationSonataUserBundle:User
My code is:
/**
*
* @ORM\ManyToOne(targetEntity="\Application\Sonata\UserBundle\Entity\User", inversedBy="entry")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $users;
I use this instruccion:
$em = $this->getDoctrine()->getEntityManager();
$query = $em->createQuery('SELECT b
FROM LoggerFrontendBundle:Entry a JOIN a.ApplicationSonataUserBundle:User b
') ;
Thanks