DDC-2415: CustomIdGenerator not inherited from MappedSuperclass #3030

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

Originally created by @doctrinebot on GitHub (Apr 25, 2013).

Jira issue originally created by user fxgallego:

I had a problem with a CUSTOM id generation mapping definition.
I have an abstract class and @MappedSuperclass which defines the id column as:

/****
 * @ORM\Id
 * @ORM\Column(name="ID", type="integer")
 * @ORM\GeneratedValue(strategy="CUSTOM")
 * @ORM\CustomIdGenerator(class="Infoil\Extensions\ExtensionsBundle\DoctrineIdGenerator\ZafiroIdGenerator")
 * @var int $id
 */

The problem is that subclasses doesn't inherits the CustomIdGenerator annotation. I have traced the problem up to ClassMetadataFactory::doLoadMetadata.
I had to change the second inner if statement as

if ($parent->isMappedSuperclass) {
$class->setCustomRepositoryClass($parent->customRepositoryClassName);
$class->setCustomGeneratorDefinition($parent->customGeneratorDefinition); <<<<< LINE ADDED
}
to allow subclasses inherit the customGenerationdefinition.

Aside, the docblock annotation help doesn't includes the CustomIdGenerator tag.

Originally created by @doctrinebot on GitHub (Apr 25, 2013). Jira issue originally created by user fxgallego: I had a problem with a CUSTOM id generation mapping definition. I have an abstract class and @MappedSuperclass which defines the id column as: ``` /**** * @ORM\Id * @ORM\Column(name="ID", type="integer") * @ORM\GeneratedValue(strategy="CUSTOM") * @ORM\CustomIdGenerator(class="Infoil\Extensions\ExtensionsBundle\DoctrineIdGenerator\ZafiroIdGenerator") * @var int $id */ ``` The problem is that subclasses doesn't inherits the CustomIdGenerator annotation. I have traced the problem up to ClassMetadataFactory::doLoadMetadata. I had to change the second inner if statement as if ($parent->isMappedSuperclass) { $class->setCustomRepositoryClass($parent->customRepositoryClassName); $class->setCustomGeneratorDefinition($parent->customGeneratorDefinition); <<<<< LINE ADDED } to allow subclasses inherit the customGenerationdefinition. Aside, the docblock annotation help doesn't includes the CustomIdGenerator tag.
admin added the Bug label 2026-01-22 14:10:18 +01:00
admin closed this issue 2026-01-22 14:10:19 +01:00
Author
Owner

@doctrinebot commented on GitHub (Apr 27, 2013):

Comment created by @FabioBatSilva:

Fixed : d513e0f084

@doctrinebot commented on GitHub (Apr 27, 2013): Comment created by @FabioBatSilva: Fixed : https://github.com/doctrine/doctrine2/commit/d513e0f084eb4e67ccb42877b28a27d47a561665
Author
Owner

@doctrinebot commented on GitHub (Apr 27, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Apr 27, 2013): 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#3030