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

Closed
opened 2026-01-22 12:41:51 +01:00 by admin · 7 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 16, 2010).

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.

Originally created by @doctrinebot on GitHub (Mar 16, 2010). 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.
admin added the Bug label 2026-01-22 12:41:51 +01:00
admin closed this issue 2026-01-22 12:41:52 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 18, 2010):

Comment created by romanb:

This should be fixed now in trunk.

@doctrinebot commented on GitHub (Mar 18, 2010): Comment created by romanb: This should be fixed now in trunk.
Author
Owner

@doctrinebot commented on GitHub (Mar 18, 2010):

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 commented on GitHub (Mar 18, 2010): 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));
Author
Owner

@doctrinebot commented on GitHub (Mar 18, 2010):

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 commented on GitHub (Mar 18, 2010): Comment created by ksid: Thanks Roman. Looks like the update has a few typos. I'll upload a patch for this in a moment.
Author
Owner

@doctrinebot commented on GitHub (Mar 18, 2010):

Comment created by romanb:

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

@doctrinebot commented on GitHub (Mar 18, 2010): Comment created by romanb: Whoops. Sorry. Fixed now. Looks like we need some more test coverage for that.
Author
Owner

@doctrinebot commented on GitHub (Mar 18, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 18, 2010): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Mar 18, 2010):

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 commented on GitHub (Mar 18, 2010): 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.
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/04b179732418017473a7

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/04b179732418017473a7 - [10485_changetrackingfix.patch](https://gist.github.com/04b179732418017473a7#file-10485_changetrackingfix-patch)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#540