Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2415

CustomIdGenerator not inherited from MappedSuperclass

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.3
    • Fix Version/s: 2.4
    • Component/s: ORM
    • Labels:

      Description

      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.

        Activity

        Show
        fabio.bat.silva Fabio B. Silva added a comment - Fixed : https://github.com/doctrine/doctrine2/commit/d513e0f084eb4e67ccb42877b28a27d47a561665

          People

          • Assignee:
            fabio.bat.silva Fabio B. Silva
            Reporter:
            fxgallego Sebastian Calvo
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: