[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


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.

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 :

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 Oct 08 19:50:35 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.