【发布时间】:2015-12-08 17:02:06
【问题描述】:
我试图将实体放在我的 Symfony 项目之外,因为我希望 Doctrine 实体与其他东西共享。我阅读了文档并在 config.yml 中提出了这个
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: false
mappings:
backend:
type: annotation
dir: %kernel.root_dir%/../../common/Backend/Entity
prefix: Backend\Entity
alias: Backend
is_bundle: false
但是,当我启动应用程序/尝试加载依赖数据的页面时,我收到此错误:
[Doctrine\Common\Persistence\Mapping\MappingException]
Class 'Backend\Entity\PortalUser' does not exist
我猜我需要告诉 Symfony 查看一个目录,但我认为这是由“dir”配置完成的。所以我在这里遗漏了一些东西。
composer.json 中的自动加载配置:
"autoload": {
"psr-4": {
"": ["src/","../common/"]
},
"files": [
"app/AppKernel.php"
]
},
【问题讨论】:
标签: php doctrine-orm symfony