更新时间:2022-01-23 19:24:29
映射名称为TestUserBundle
,但路径为Test\Bundle\User\Bundle
,不是应该将其命名为TestBundleUserBundle
吗?另外,通常在开发模式下将mappings
和auto_generate_proxy_classes
设置为true
,这可能解释了为什么它在这里工作而不在产品中工作.
Mapping name is TestUserBundle
but the path is Test\Bundle\User\Bundle
, shouldn't it be named TestBundleUserBundle
instead? Also, usually the mappings
and auto_generate_proxy_classes
are set to true
in dev mode which might explain why it's working there and not in prod.
You might want to checkout the documentation (Symfony 2.7) which shows how exactly you should be configuring the mappings depending on your case.
doctrine:
# ...
orm:
# ...
auto_mapping: true
mappings:
# ...
AppBundle:
type: xml
dir: SomeResources/config/doctrine
doctrine:
# ...
orm:
# ...
mappings:
# ...
SomeEntityNamespace:
type: annotation
dir: "%kernel.root_dir%/../src/Entity"
is_bundle: false
prefix: App\Entity
alias: App
最后但并非最不重要的一点是,在对config.yml
或app/config/
目录中的文件进行更改后,始终清除缓存目录.
Last, but not least, always clear your cache directory after applying changes to the config.yml
or files in the app/config/
directory.
如评论中所述: 您需要暂时停止可能使用prod目录的所有PHP进程(即,如果您已经运行console server:run),然后重试.如果这样做没有效果,请尝试此
As mentioned in the comments: You need to temporarily stop any PHP processes that might be using the prod directory (i.e. if you've ran console server:run) and try again. If that doesn't do it, try this