Недействительная сущность или ошибка сопоставленного суперкласса из Doctrine

Я пытаюсь настроить Doctrine (2.2.1) для использования с моим сайтом, следуя руководству по началу работы, и получаю следующую ошибку:

Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Class   DocumentField is not a valid entity or mapped super class.' in C:\inetpub\sites\hd\Doctrine\ORM\Mapping\MappingException.php:147 Stack trace: #0 C:\inetpub\sites\hd\Doctrine\ORM\Mapping\Driver\AnnotationDriver.php(165) {...}

DocumentFieldопределяется следующим образом (в root/Doctrine/entities/DocumentField.php:

<?php
/** @Entity **/
/** @Table(name="DocumentFields") */
class DocumentField
{
    /** @Id @GeneratedValue @Column(type="integer") **/
    protected $id;
    /** @var @Column(type="string") **/
    protected $fieldName;
    /** @var @Column(type="integer") **/
    protected $fieldType;
    /** @var @Column(type="integer") **/
    protected $required;

    public function getId() {
        return $this->id;
    }

    public function getName() {
        return $this->fieldName;
    }

    public function setName($name) {
        $this->fieldName = $name;
    }

    public function getType() {
        return $this->fieldType;
    }

    public function setType($type) {
        $this->fieldType = $type;
    }

    public function getRequired() {
        return $this->required;
    }

    public function setRequired($value) {
        $this->required = $value;
    }
}

?>

Doctrine включается на страницу следующим образом:

/* Load Doctorine ORM */
require "$root/Doctrine/ORM/Tools/Setup.php";
$lib = "$root/";
Doctrine\ORM\Tools\Setup::registerAutoloadDirectory($lib);
require "doctrine-configure.php";

The doctrine-configure. файл php:

//if ($applicationMode == "development") {
    $cache = new \Doctrine\Common\Cache\ArrayCache;
//} else {
//    $cache = new \Doctrine\Common\Cache\ApcCache;
//}

$config = new Configuration;
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver($GLOBALS["BASE_PATH"].'\\Doctrine\\entities');
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
$config->setProxyDir($GLOBALS["BASE_PATH"].'\\Doctrine\\proxies');
$config->setProxyNamespace('Helpdesk\Proxies');

//if ($applicationMode == "development") {
    $config->setAutoGenerateProxyClasses(true);
//} else {
//    $config->setAutoGenerateProxyClasses(false);
//}

$connectionOptions = array(
    'driver' => 'pdo_sqlsrv',
    'user' => '{user}',
    'password' => '{pass}',
    'host' => 'sql1',
    'dbname' => 'HD'
);

$entityManager = EntityManager::create($connectionOptions, $config);

?>

И, наконец, код, вызывающий сбой:

require "$root/Doctrine/entities/DocumentField.php";
$field = new DocumentField();
$field->setName("Hello World");
$field->setType(1);
$field->setRequired(1);
$entityManager->persist($field);
$entityManager->flush();
5
задан j0k 23 October 2012 в 14:06
поделиться