Answer the question
In order to leave comments, you need to log in
How to create a connection between entities and a form for this connection?
Good afternoon.
There are two entities - User and Territory. Only one Territory can belong to one User, but several Users can belong to one Territory. This is clearly OneToMany, but there are a couple of "buts".
Firstly, no Territory may apply to the User at all. nullable=true and be done with it? Well, yes, as a way out of the situation it can be considered.
Secondly, I have several application fragments that somehow relate to User. Territory is one of them. Therefore, I do not want to produce the fields territory_id, blablabla_id, foo_id, bar_id, etc. in the users table. as the application grows.
From here a question - how to organize communication between User and Territory in the third table (user_to_territory for example).
I hope the question is clear.
Answer the question
In order to leave comments, you need to log in
No way.
The Doctrine will make the third table for you.
And, yes, you will have to "produce". Over time, you will understand what happiness it is when all the connections are clearly spelled out in essence, and you don’t have to rush like a mad dog through the code to find how your essences relate to each other.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question