DDC-1244: [regression] Entities generator fails to update entities without any namespace, always append the generated definitions to the end of the class #1569

Closed
opened 2026-01-22 13:18:26 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 1, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user venimus:

If Entities have no namespace set (e.g. custom AutoLoader) schema tool fails to find the original methods and properties and always append the definitions to the end of the file, which leads to duplications of class definitions.

This is because in \Doctrine\ORM\Tools\EntitiesGenerator.php at line 441:

441: $lastSeenClass = $lastSeenNamespace . '\\' . $token[1];

$lastSeenClass is always prefixed with "" when checking for existing definitions

it could be fixed as:

441: $lastSeenClass = $lastSeenNamespace. ($lastSeenNamespace ? '\\' : '') . $token[1];

I had an environment where the classes without any specified namespace are autoloaded from Entities directory, which makes generate-entities fail to work properly since Doctrine 2.0.4

Originally created by @doctrinebot on GitHub (Jul 1, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user venimus: If Entities have no namespace set (e.g. custom AutoLoader) schema tool fails to find the original methods and properties and always append the definitions to the end of the file, which leads to duplications of class definitions. This is because in **\Doctrine\ORM\Tools\EntitiesGenerator.php** at line 441: `441: $lastSeenClass = $lastSeenNamespace . '\\' . $token[1];` $lastSeenClass is always prefixed with "\" when checking for existing definitions it could be fixed as: `441: $lastSeenClass = $lastSeenNamespace. ($lastSeenNamespace ? '\\' : '') . $token[1];` I had an environment where the classes without any specified namespace are autoloaded from Entities directory, which makes generate-entities fail to work properly since Doctrine 2.0.4
admin added the Bug label 2026-01-22 13:18:26 +01:00
admin closed this issue 2026-01-22 13:18:26 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 12, 2011):

Comment created by @beberlei:

Fixed

@doctrinebot commented on GitHub (Jul 12, 2011): Comment created by @beberlei: Fixed
Author
Owner

@doctrinebot commented on GitHub (Jul 12, 2011):

Issue was closed with resolution "Fixed"

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

No dependencies set.

Reference: doctrine/archived-orm#1569