教义不能重新声明类注释

时间:2015-11-18 11:32:00

标签: php orm doctrine-orm annotations doctrine

我有自己的引导程序

    <?php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

// Log Filename
define ('LOG_FILENAME', 'clicktocall-'.date("Ymd").'log');

$loader = require "vendor/autoload.php";
// Doctrine parser
Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

// Create a simple "default" Doctrine ORM configuration for Annotations
$isDevMode = true;
$config = Setup::createAnnotationMetadataConfiguration(array("./src/acme"), $isDevMode);

// Database configuration parameters
$dbParams = array(
    'driver'    => 'pdo_mysql',
    'host'      => 'localhost',
    'user'      => 'xxx',
    'password'  => 'yyy',
    'dbname'    => 'zzz',
);

// Obtaining the entity manager
$em = EntityManager::create($dbParams, $config);

// Setting Logger Monolog
$Logger = new \Monolog\Logger('CTLogger');
$Logger->pushHandler(new \Monolog\Handler\StreamHandler('./log/'.LOG_FILENAME, \Monolog\Logger::INFO));

当我试图执行

vendor\bin\doctrine orm:schema-tool:update --force

我收到此消息

  

致命错误:无法在E:\ www \ acme \ vendor \ doctri中重新声明类Doctrine \ ORM \ Mapping \ Annotation   第22行的ne \ orm \ lib \ Doctrine \ ORM \ Mapping \ Annotation.php

我只是在使用Doctrine包。 任何的想法? 非常感谢

[编辑] 我发现问题是由     Doctrine \ Common \ Annotations \ AnnotationRegistry :: registerLoader(array($ loader,'loadClass'));

我使用此行来解析symfony \ validator包的注释,但是这样验证不起作用......

0 个答案:

没有答案