class User
{
...
/**
*
* @ORM\OneToOne(targetEntity="Profil", inversedBy="user")
*/
private $profil;
/**
* Set profil
*
* @param My\FrontendBundle\Entity\Profil $profil
*/
public function setProfil(\My\FrontendBundle\Entity\Profil $profil)
{
$this->profil = $profil;
}
/**
* Get profil
*
* @return My\FrontendBundle\Entity\Profil
*/
public function getProfil()
{
return $this->profil;
}
...
}
Listing 31.17. Klasa User: definicja dwukierunkowej relacji 1:1
Rozdział 31. Relacje 1:1