Fixed relationship between user and userdata.
This commit is contained in:
parent
56de160dc1
commit
45b4e11fef
@ -61,7 +61,7 @@ class DefaultController extends Controller
|
||||
$form->bindRequest($request);
|
||||
if ($form->isValid())
|
||||
{
|
||||
if ($this->getPassword() == '')
|
||||
if ($user->getPassword() == '')
|
||||
$user->setPassword($oldPassword);
|
||||
else
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
|
@ -26,7 +26,8 @@ class UserData
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @ORM\Id
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\GeneratedValue(strategy="NONE")
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected $user;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user