I'm trying to create a friends system, and I need a Many-to-Many relationship to User objects; at the moment this is what i have done:
/** * @ORM\ManyToMany(targetEntity="User", mappedBy="friends") */ protected $friendsWith; /** * @ORM\ManyToMany(targetEntity="User", inversedBy="friendsWith") * @JoinTable(name="friends", * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}, * inverseJoinColumns={@JoinColumn(name="friend_user_id", referencedColumnName="id")} * ) */ protected $friends;
But I would like to have additional fields for this relationship, for example, the date of creation or the state (accepted, pending, ...); I created another Friend object, and I would like this object to be used as a link between friends. But I do not know how to do this ...
Do you have any ideas?
Thanks!
source share