Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2415

CustomIdGenerator not inherited from MappedSuperclass

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major 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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: