Deprecate EntityGenerator and Exporters #6620

Closed
opened 2026-01-22 15:35:49 +01:00 by admin · 0 comments
Owner

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:

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: - Symfony Maker Bundle generates Doctrine entities - Laminas Code Generator: https://github.com/laminas/laminas-code 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: - https://github.com/doctrine/orm/pull/6870 - https://github.com/doctrine/orm/pull/6869
admin added the Deprecation label 2026-01-22 15:35:49 +01:00
admin closed this issue 2026-01-22 15:35:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6620