[DDC-1660] Annotation @version is not allowed to be declared on class Created: 20/Feb/12  Updated: 03/Mar/12  Resolved: 03/Mar/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM
Affects Version/s: 2.2
Fix Version/s: 2.2.1
Security Level: All

Type: Bug Priority: Major
Reporter: Miroslav Fedeles Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


 Description   

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.



 Comments   
Comment by Benjamin Eberlei [ 20/Feb/12 ]

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

Comment by Benjamin Eberlei [ 20/Feb/12 ]

Its definately a BC break.

Comment by Fabio B. Silva [ 20/Feb/12 ]

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

Comment by Benjamin Eberlei [ 20/Feb/12 ]

This breaks BC, so we cant do this.

Comment by Benjamin Eberlei [ 03/Mar/12 ]

Merged PR into master and 2.2

Generated at Thu Apr 24 10:42:16 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.