mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Deprecate EntityGenerator and Exporters #6620
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @beberlei on GitHub (Feb 6, 2021).
The EntityGenerator and the exporters/converters that depend on it are going to get removed in Doctrine 3 without a replacement.
The reason we are parting from this code is mostly, that the requirements for code generating entities are so vast, with respect to how getters/setters are generator, should public properties be used, code styles, collection methods and more that the configuration options are exploding for this class without us ever being able to reject code, because all use cases sort of make sense.
In addition the EntityGenerator does not support adding custom code, and then re-generating the code again. This is a major PITA and a code generator should probably instead generate traits that are imported into user entity classes.
Anyways the requirements towards a code generator are too wide to provide a good solution that we can be proud of, so instead we want to emphasize that code generation is not a part of what we think how Doctrine should be used.
Third party alternatives:
Other approach:
We would also recommend to inline the EntityGenerator into your own codebase if you rely on its specific behavior heavily. This also gives you the opportunity to exercise much more control over the fine details.
Original work: