Reputation: 4103
i'm trying to install the "gedmo" behaviourial extensions (version 2.1.0-DEV) in Doctrine2 (version 2.1.3).
Without the extensions everything works fine. However, when I add the annotationdriver to read the @gedmo-annotations errors such as "Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Class User2 is not a valid entity or mapped super class
" are thrown.
This is de User2-entity:
<?php
use \Doctrine\ORM\Mapping as ORM;
/** @ORM\Entity */
class User2 {
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** @ORM\Column(length=255) */
private $username;
}
Because these errors occur even in the Entities where @gemdo is not used i suspect it has something to do with the way the annotationdrivers are configured. In my bootstrap-file the annotation driver is added (i'm only going to use the tree-extension):
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader);
$chain = new \Doctrine\ORM\Mapping\Driver\DriverChain;
$chain->addDriver($annotationDriver, 'Gedmo\Tree\Entity');
$config->setMetadataDriverImpl($chain);
A few questions:
In short: how can I make the @orm and @gedmo annotations work?
Upvotes: 2
Views: 4742