Doctrine 2.0 ReflectionException当我尝试做YAML Mapping [英] Doctrine 2.0 ReflectionException when I try to do YAML Mapping
问题描述
$ driverImpl = new \Doctrine\ORM\\ \\Mapping\Driver\YamlDriver(阵列(__ DIR __ '/ YAML'));
$ driverImpl-> setFileExtension('。yml');
$ config-> setMetadataDriverImpl($ driverImpl);
在./yaml中有yml文件(Client.yml,Worker.yml,Company.yml )
当我运行该文件以在db中生成具有此通知的模式时:
code> php doctrine orm:schema-tool:create
throws:
PHP警告:class_parents():Class Client不存在,无法加载到applicationPath\system\application\libraries\Doctrine \MM\Mapping\ClassMetadataFactory.php在第222行
警告:class_parents():Class Cliente不存在,无法加载到applicationPath\\\system\application\ library\Doctrine\ORM\Mapping\ClassMetadataFactory.php在第222行
PHP警告:array_reverse()期望参数1为数组,在applicationPath\\\system\application\libraries中给出布尔值\Doctrine\ORM\Mapping\ClassMetadataFactory。 php on line 222
警告:array_reverse()期望参数1为数组,在applicationPath中给出布尔值\\system\application\libraries\Doctrine\ORM\Mapping\ ClassMetadataFactory.php第222行
PHP警告:在第222行的applicationPath\\\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php中为foreach()提供无效参数
警告:在第222行的applicationPath\\\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php中为foreach()提供的参数无效
[ReflectionException]
类客户端不存在
Doctrine文档 http://www.doctrine-project.org/docs/orm/2.0/en/reference/yaml-mapping.html
我不知道为什么会这样发生,任何想法?
感谢
IIRC,SchemaTool将生成基于ClassMetadata实例的SQL,而不是直接从您的YAML映射。 ClassMetadata实例也需要您的实体实体类
确保您的命令行工具加载/自动加载所有实体类。
I have in my cli-config.php this code:
$driverImpl = new \Doctrine\ORM\Mapping\Driver\YamlDriver(array(__DIR__.'/yaml'));
$driverImpl->setFileExtension('.yml');
$config->setMetadataDriverImpl($driverImpl);
In ./yaml there are the yml files (Client.yml,Worker.yml,Company.yml)
When i run the file to generate in db the schema with this instruccion:
php doctrine orm:schema-tool:create
throws:
PHP Warning: class_parents(): Class Client does not exist and could not be loaded in applicationPath\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
Warning: class_parents(): Class Cliente does not exist and could not be loaded in applicationPath\\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
PHP Warning: array_reverse() expects parameter 1 to be array, boolean given in applicationPath\\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
Warning: array_reverse() expects parameter 1 to be array, boolean given in applicationPath\\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
PHP Warning: Invalid argument supplied for foreach() in applicationPath\\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
Warning: Invalid argument supplied for foreach() in applicationPath\\system\application\libraries\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
[ReflectionException]
Class Client does not exist
It´s the same that Doctrine documentation http://www.doctrine-project.org/docs/orm/2.0/en/reference/yaml-mapping.html
I don´t why it´s happening this, any idea? Thanks
IIRC, the SchemaTool will generate the SQL based on ClassMetadata instances, not directly from your YAML mappings. ClassMetadata instances require your actual entity classes as well
Make sure your command line tool has all your entity classes loaded/autoloaded.
这篇关于Doctrine 2.0 ReflectionException当我尝试做YAML Mapping的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!