Fixed relationship between user and userdata.

This commit is contained in:
Polonkai Gergely
2012-07-17 18:41:56 +02:00
parent 56de160dc1
commit 45b4e11fef
3 changed files with 6 additions and 6 deletions

View File

@@ -247,8 +247,7 @@ class User implements UserInterface, AdvancedUserInterface
/**
* @var \KekRozsak\FrontBundle\Entity\UserData $userData
* @ORM\OneToMany(targetEntity="KekRozsak\FrontBundle\Entity\UserData", fetch="LAZY", cascade={"persist"}, mappedBy="user")
* @ORM\JoinColumn(name="id", referencedColumnName="user_id")
* @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", fetch="LAZY", cascade={"persist"}, mappedBy="user")
*/
protected $userData;
@@ -261,7 +260,7 @@ class User implements UserInterface, AdvancedUserInterface
*/
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
{
$this->userData = new ArrayCollection(array($userData));
$this->userData = $userData;
$userData->setUser($this);
return $this;
}
@@ -273,7 +272,7 @@ class User implements UserInterface, AdvancedUserInterface
*/
public function getUserData()
{
return $this->userData->get(1);
return $this->userData;
}
/**