Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-433

@ChangeTrackingPolicy values are not converted to integers

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-ALPHA4
    • Fix Version/s: 2.0-BETA1
    • Component/s: Mapping Drivers
    • Security Level: All
    • Labels:
      None

      Description

      The value specified on the @ChangeTrackingPolicy annotation does not get converted to it's constant counterpart.

      @ChangeTrackingPolicy("NOTIFY") is stored on the ClassMetadataInfo class as the string value "NOTIFY" and not converted to ClassMetadataInfo::CHANGETRACKING_NOTIFY. Passing an integer value works as expected.

      This means all ClassMetadataInfo#isChangeTracking* methods return false. I've attached the patch I'm currently using based off r7404.

        Activity

        Hide
        Roman S. Borschel added a comment -

        This should be fixed now in trunk.

        Show
        Roman S. Borschel added a comment - This should be fixed now in trunk.
        Hide
        Hannes Magnusson added a comment -

        That looks like a typo to me Roman. Shouldn't it be $changeTrackingAnnot?

        $changeTrackingAnnot = $classAnnotations['Doctrine\ORM\Mapping\ChangeTrackingPolicy'];

        • $metadata->setChangeTrackingPolicy(constant('\Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' . $inheritanceTypeAnnot->value));
          + $metadata->setChangeTrackingPolicy(constant('\Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' . $changeTrackingAnnot->value));
        Show
        Hannes Magnusson added a comment - That looks like a typo to me Roman. Shouldn't it be $changeTrackingAnnot? $changeTrackingAnnot = $classAnnotations ['Doctrine\ORM\Mapping\ChangeTrackingPolicy'] ; $metadata->setChangeTrackingPolicy(constant('\Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' . $inheritanceTypeAnnot->value)); + $metadata->setChangeTrackingPolicy(constant('\Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' . $changeTrackingAnnot->value));
        Hide
        Kawsar Saiyeed added a comment -

        Thanks Roman. Looks like the update has a few typos. I'll upload a patch for this in a moment.

        Show
        Kawsar Saiyeed added a comment - Thanks Roman. Looks like the update has a few typos. I'll upload a patch for this in a moment.
        Hide
        Roman S. Borschel added a comment -

        Whoops. Sorry. Fixed now. Looks like we need some more test coverage for that.

        Show
        Roman S. Borschel added a comment - Whoops. Sorry. Fixed now. Looks like we need some more test coverage for that.
        Hide
        Kawsar Saiyeed added a comment -

        Thanks Roman. Had the comment window open for a while so Hannes got in there before me.

        On a side note, shouldn't ClassMetadataInfo be used instead of ClassMetadata? Also, all constant() calls do not start the class names with a backslash with the exception of lines 176 and 198.

        Show
        Kawsar Saiyeed added a comment - Thanks Roman. Had the comment window open for a while so Hannes got in there before me. On a side note, shouldn't ClassMetadataInfo be used instead of ClassMetadata? Also, all constant() calls do not start the class names with a backslash with the exception of lines 176 and 198.

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Kawsar Saiyeed
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: