I have 2 tables like this:
Users - UserID - Username - Password - ...
Players
- playerID
- playerName
- ...
- User
The relation is ManyToOne
(see the picture) and it's not required.
I've generated my entities automatically with Doctrine. In my player Entity I have:
/**
* @var \NV\VolleyScoutBundle\Entity\Users
*
* @ORM\ManyToOne(targetEntity="NV\VolleyScoutBundle\Entity\Users")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="user_id", referencedColumnName="user_id")
* })
*/
protected $user;
But I don't have a $player
variable in my Users Entity. In what way can I add this? Tried to do this but gave me different errors. What I'm trying to do is add a player form to my register form.
So in my RegisterType (=form) I woud like to add ->add('player', new PlayerType())
. But that's not possible without a $player variable in my Users entity.
What type of relation do I need to setting for $player in my Users entity?