Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Blocker
-
Resolution: Invalid
-
Affects Version/s: 2.1
-
Fix Version/s: None
-
Component/s: Annotations
-
Labels:None
-
Environment:Windows 7 64-bit, PHP v5.3.1
Description
My annotations were working fine with v2.0.5. Once I upgraded to v2.1 they stopped working. Using this condensed code based on the v2.1 documentation on Annotations (http://www.doctrine-project.org/docs/common/2.1/en/reference/annotations.html):
require 'c:/dev/library/doctrine-orm/Doctrine/Common/ClassLoader.php'; $classLoader = new \Doctrine\Common\ClassLoader('Doctrine', 'c:/dev/library/doctrine-orm'); $classLoader->register(); $classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'c:/dev/library/doctrine-orm/Doctrine'); $classLoader->register(); $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader->setIgnoreNotImportedAnnotations(true); $reader->setEnableParsePhpImports(false); $className = 'User'; $reflectionClass = new \ReflectionClass($className); $classAnnotations = $reader->getClassAnnotations($reflectionClass); echo "Class Annotations - $className:\n"; print_r($classAnnotations); /** * @Annotation */ class Foo { public $bar; } /** * @Foo(bar="foo") */ class User { }
The result is:
Class Annotations - User: Array ( [0] => Foo Object ( [bar] => ) )
Why is bar empty? If I remove the @Foo annotation from the docblock for the User class, then the result is an empty array. So it's clearly detecting the annotation, it's just not setting the annotation property.
This is blocking me from upgrading to v2.1