Skip to content

Loading…

DDC-433: @ChangeTrackingPolicy values are not converted to integers #4933

Closed
doctrinebot opened this Issue · 7 comments

1 participant

@doctrinebot

Jira issue originally created by user ksid:

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.

@doctrinebot

Comment created by romanb:

This should be fixed now in trunk.

@doctrinebot

Comment created by bjori:

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));
@doctrinebot

Comment created by ksid:

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

@doctrinebot

Comment created by romanb:

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

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by ksid:

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.

@doctrinebot doctrinebot added this to the 2.0-BETA1 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.