Не получается настроить работу с библиотекой
Doctrine2 behavioral extensions.
А именно нужен функционал Tree.
Ошибка:
Fatal error: Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@Entity" in class Tree was never imported. Did you maybe forget to add a "use" statement for this annotation?' in C:\OpenServer\domains\doctrine\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\AnnotationException.php on line 54
Bootstrap.phpuse Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require_once "vendor/autoload.php";
$entityPath = array('src');
$isDevMode = true;
$config = Setup::createAnnotationMetadataConfiguration($entityPath, $isDevMode);
$databaseParameters = array('driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => 'doctrine');
$entityManager = EntityManager::create($databaseParameters, $config);
/src/Tree.php<?php
/**
* @Entity(repositoryClass="TreeRepository")
* @Table(name="Tree")
*/
class Tree {
/**
* @Id @GeneratedValue @Column(type="integer")
*
* @var int
*/
private $id;
public function getId() {
return $this->id;
}
}
/src/TreeRepository.php<?php
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
class TreeRepository extends NestedTreeRepository
{
}
tree.phprequire_once 'bootstrap.php';
$treeListener = new Gedmo\Tree\TreeListener();
$entityManager->getEventManager()->addEventSubscriber($treeListener);
$repository = $entityManager->getRepository('Tree');
$subNode = $repository->findOneByTitle('root');
$path = $repository->getPath($subNode);
В чем заключается ошибка? Кучу времени потратил на решение, так и не разобрался.