DDC-2860: [GH-880] (v2.3.4) corrected inheritance when generating (updating) existing entities #3571

Closed
opened 2026-01-22 14:22:50 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 16, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of peetersdiet:

Url: https://github.com/doctrine/doctrine2/pull/880

Message:

I have modified the EntityGenerator-class so the script to generate entities takes inheritance of existing entities into account when generating getters and setters. This will only affect existing entities, not newly created.

The command 'orm:generate-entities' (and related symfony2 command 'doctrine:generate:entities') will now generate properties and methods in existing entitities that will not clash with those higher in the inheritance-chain. This effectively fixes the errors like 'PHP Fatal error: Access level to ... must be (protected|private|public) ...' after running the generate-entities command.

Basic rules added for updating existing entities if a property|method is found higher up the hierarchy:

  • when private higher up it will be copied into the child-entity,
  • when protected or public higher up it will be skipped

I have tested this with the command 'doctrine:generate:entities' on Symfony 2.3 with doctrine/orm v2.3.4. .

Edit: I seem to have referenced the wrong branch when creating the pull request. I branched from tag 2.3.4 .

Originally created by @doctrinebot on GitHub (Dec 16, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @doctrinebot: This issue is created automatically through a Github pull request on behalf of peetersdiet: Url: https://github.com/doctrine/doctrine2/pull/880 Message: I have modified the EntityGenerator-class so the script to generate entities takes inheritance of existing entities into account when generating getters and setters. This will only affect existing entities, not newly created. The command 'orm:generate-entities' (and related symfony2 command 'doctrine:generate:entities') will now generate properties and methods in existing entitities that will not clash with those higher in the inheritance-chain. This effectively fixes the errors like 'PHP Fatal error: Access level to ... must be (protected|private|public) ...' after running the generate-entities command. Basic rules added for updating existing entities if a property|method is found higher up the hierarchy: - when private higher up it will be copied into the child-entity, - when protected or public higher up it will be skipped I have tested this with the command 'doctrine:generate:entities' on Symfony 2.3 with doctrine/orm v2.3.4. . Edit: I seem to have referenced the wrong branch when creating the pull request. I branched from tag 2.3.4 .
admin added the Bug label 2026-01-22 14:22:50 +01:00
admin closed this issue 2026-01-22 14:22:51 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2014):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-880] was closed:
https://github.com/doctrine/doctrine2/pull/880

@doctrinebot commented on GitHub (Jan 2, 2014): Comment created by @doctrinebot: A related Github Pull-Request [GH-880] was closed: https://github.com/doctrine/doctrine2/pull/880
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2014):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Jan 2, 2014): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3571