How do I implement the following scenario the best way in ORM (Doctrine)?
Scenario: A user can belong to one or many teams. A team can consist of one or many users.
So, the first part is no problem, but I want the user to have an "activation_status" for every team he belongs.
So as I'm coming from SQL and relational databases i could add an "activation_status" field in my many-to-many relationship table "team2user"
-> database fields: team_id, user_id, activation_status
But how can I implement that with Doctrine? I persist the entities team and user. But how do I persist the activation_status correctly?
Many thanks in advance.
I think you could revise your entities and add an Activation Entity, that way your entities would be like this:
You can also define ManyToMany relationship between User and Team through Activation entity.