I would like to create a notification system. There is a Notification
class. A notification can be assigned to more than one users, not just one.
There is a joint table user_notifications
, with two columns: user_id
and notification_id
The definition of the $notifications
in the user class is this:
/**
* @ManyToMany(targetEntity="Notification")
* @JoinTable(name="user_notifications",
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="notification_id", referencedColumnName="id", unique=true)}
* )
**/
private $notifications;
Everything works fine. But I would like to add a new column to the user_notifications
table, where I would like to store, if the notification is read by the given user, or not. How should I manage it in Doctrine2?