I have to use \Doctrine\Common\Annotations\AnnotationRegistry::registerFile
to access the annotation registry in entity files.
This part is required to use the driver chain and use the orm: schema-tool: creator. but I cannot add every class I need by adding AnnotationRegistry::registerFile
.
this problem was visible when I want to add Gedmo to my Doctrine 2.2.2.
and my file object is here
namespace Entity; use \Doctrine\Common\Collections\ArrayCollection; use \Doctrine\ORM\Mapping as ORM; class User { protected $id; protected $name; public function getId() { return $this->id; } public function setId($id) { $this->_id = $id; return $this; } public function getName() { return $this->id; } public function setName($name) { $this->_id = $name; return $this; } }
error:
[Doctrine\Common\Annotations\AnnotationException] [Semantical Error] The annotation "@\Doctrine\ORM\Mapping\Entity" in class Entity\User does not exist, or could not be auto-loaded.
source share