How do I map user_id field from user table to other tables. I am using Symfony2 and FOSUserBundle.
I have already tried by this way
My Contacts Entity
/*
* @ORM\ManyToOne(targetEntity="User", inversedBy="contacts")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $user;
My User Entity
/**
* @ORM\OneToMany(targetEntity="Contacts", mappedBy="user")
*/
protected $contact;
I did
doctrine:schema:update --force
Nothing to update - your database is already in sync with the current entity metadata.
There should be user_id field added to contacts table.
I tried adding cascade -- Ref Link
/**
* @ORM\OneToMany(targetEntity="Contacts", mappedBy="user",cascade={"persist"})
*/
protected $contact;
But even that is not helping.