Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.1
-
Fix Version/s: 2.2
-
Component/s: Annotations
-
Labels:None
-
Environment:Ubuntu 10.04, Zend Server CE 5.1.0 (Apache 2.2.14, PHP 5.3.5), Doctrine 2.1
Description
Having a class named Entity in the global namespace, results in exceptions: "Class xxx is not a valid entity or mapped super class."
The problem is not present in 2.0
The problem:
\Doctrine\Common\Annotations\DocParser.php
line 421: $reflClass = new \ReflectionClass($name);
$name is "Entity", and the reflection finds the non-doctrine Entity-class in the global namespace, and so doesn't find the "@Annotation" it's looking for when it examines the class.
If I force it to reflect on \Doctrine\ORM\Mapping\Entity instead, the next problem is instantiation:
\Doctrine\Common\Annotations\DocParser.php
line 435: return new $name($values);
Forcing that to the right class, brings a "Failed opening required 'Doctrine/ORM/Mapping/Doctrine/ORM/Mapping/Id.php' " - I haven't investigated further (yet at least).
/Michael
Fixed https://github.com/doctrine/common/commit/481083226477b325decfd7202ff59c252397c392