Answer the question
In order to leave comments, you need to log in
Why Doctrine ORM generates Entities in some cases Unidirectional and in others Bidirectional?
I did not particularly delve into the annotations of the Doctrine. I just generate classes and set/get methods.
There are two parts of the database. Both have seemingly identical tables and 1 : N relationships. Using doctrine-module orm:convert-mapping creates unidirectional relationships in one module and bidirectional relationships in the other.
On what does such behavior of the Doctrine depend? What should be the structure of the database to generate Entities with bidirectional relationships?
Answer the question
In order to leave comments, you need to log in
Entity generation is advisory in nature to make routine work easier for the programmer.
After generation, you must independently correct the configuration of entities, including all relationships, in accordance with your requirements.
I hope you know how doctrine differs from, for example, ar in yii?
Doctrine works from the schema described in the entity config, not from the database schema. On the contrary, the database schema is generated based on the entity config.
This behavior depends directly on how you specify the links. If you specify Bidirectional then it will be so, if Unidirectional then so. No magic.
See the documentation for more details, everything is clearly written and chewed there docs.doctrine-project.org/en/latest/reference/asso...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question