DDC-1660: Annotation @version is not allowed to be declared on class #2085

Closed
opened 2026-01-22 13:40:12 +01:00 by admin · 6 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 20, 2012).

Jira issue originally created by user fedys:

I upgraded to Doctrine 2.2 and got following exception:

"Doctrine\Common\Annotations\AnnotationException [Semantical Error] Annotation @version is not allowed to be declared on class SomeEntityClass. You may only use this annotation on these code elements: PROPERTY."

In Doctrine 2.1 no such exception has been thrown. I use following annotation for all my classes in my projects:

@version Id: SomeEntityClass.php 509 2012-02-03 09:38:48Z mf

Thus I cannot upgrade to Doctrine 2.2 for now.

Originally created by @doctrinebot on GitHub (Feb 20, 2012). Jira issue originally created by user fedys: I upgraded to Doctrine 2.2 and got following exception: "Doctrine\Common\Annotations\AnnotationException [Semantical Error] Annotation @version is not allowed to be declared on class SomeEntityClass. You may only use this annotation on these code elements: PROPERTY." In Doctrine 2.1 no such exception has been thrown. I use following annotation for all my classes in my projects: @version $Id: SomeEntityClass.php 509 2012-02-03 09:38:48Z mf $ Thus I cannot upgrade to Doctrine 2.2 for now.
admin added the Bug label 2026-01-22 13:40:12 +01:00
admin closed this issue 2026-01-22 13:40:12 +01:00
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2012):

Comment created by @beberlei:

Hm maybe the SimpleAnnotationReader should not validate targets? What do you say Fabio/Johannes?

@doctrinebot commented on GitHub (Feb 20, 2012): Comment created by @beberlei: Hm maybe the SimpleAnnotationReader should not validate targets? What do you say Fabio/Johannes?
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2012):

Comment created by @beberlei:

Its definately a BC break.

@doctrinebot commented on GitHub (Feb 20, 2012): Comment created by @beberlei: Its definately a BC break.
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2012):

Comment created by @FabioBatSilva:

Hi Benjamin

This parser identifies the phpdoc annotation @version as the doctrine annotation @Doctrine\ORM\Mapping\Version

SimpleReader does not recognize entity imports. If consider the namespaces (SimpleAnnotationReader#addNamespace), this annotation exists within the namespace "Doctrine\ORM\Mapping"

This could be fixed considering just CamelCaseClasses, so @version is not equal @Version

Benjamin and Johannes, please take a look at this commit :
842bf5883c

@doctrinebot commented on GitHub (Feb 20, 2012): Comment created by @FabioBatSilva: Hi Benjamin This parser identifies the phpdoc annotation @version as the doctrine annotation @Doctrine\ORM\Mapping\Version SimpleReader does not recognize entity imports. If consider the namespaces (SimpleAnnotationReader#addNamespace), this annotation exists within the namespace "Doctrine\ORM\Mapping\" This could be fixed considering just CamelCaseClasses, so @version is not equal @Version Benjamin and Johannes, please take a look at this commit : https://github.com/FabioBatSilva/common/commit/842bf5883c405e89d211e5ccfff1d8d64e05a486
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2012):

Comment created by @beberlei:

This breaks BC, so we cant do this.

@doctrinebot commented on GitHub (Feb 20, 2012): Comment created by @beberlei: This breaks BC, so we cant do this.
Author
Owner

@doctrinebot commented on GitHub (Mar 3, 2012):

Comment created by @beberlei:

Merged PR into master and 2.2

@doctrinebot commented on GitHub (Mar 3, 2012): Comment created by @beberlei: Merged PR into master and 2.2
Author
Owner

@doctrinebot commented on GitHub (Mar 3, 2012):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 3, 2012): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2085