How can I use 'foreign key' on doctrine?
Here some cheat sheets for doctrine annotations : link
For your problem, you need to define your variables in each side of your associations.
In Lesson.php :
/** * @ORM\OneToOne( * targetEntity="Acme\UserBundle\Entity\User", * inversedBy="lessons*removethis : name of the variable in user.php*" * ) * @ORM\JoinColumn(name="user_id", referencedColumnName="id") */private $teacher;
In User.php :
/** * @ORM\OneToOne( * targetEntity="Acme\UserBundle\Entity\Lesson", * mappedBy="teacher*removethis : name of the variable in lesson.php*" * ) */private $lessons;
And yes, ManyToMany is good for the purpose your are looking for :)