不能找到捆绑的基本路径 [英] Cant find base path for bundle
问题描述
我正在使用Symfony2,并希望通过运行以下方式为实体生成getter和setter:
I'm using Symfony2 and want to generate getters and setters for the entities by running:
$ php app/console doctrine:generate:entities TestBundle
控制台返回以下消息:
[RuntimeException]找不到TestBundle的路径(路径:C:\xampp\htdocs\ProjectX\src\Namespace\TestBundle,目的地:C:/ xampp / htdocs / ProjectX / src / Namespace / TestBundle)
[RuntimeException] Can't find base path for "TestBundle" (path: "C:\xampp\htdocs\ProjectX\src\Namespace\TestBundle", destination: "C:/xampp/htdocs/ProjectX/src/Namespace/TestBundle").
该软件包存在于此位置: code> C:\xampp\htdocs\ProjectX\src\Namespace\TestBundle
The Bundle exists at this location: C:\xampp\htdocs\ProjectX\src\Namespace\TestBundle
有什么问题?
推荐答案
只要添加别的东西,以防其他人达到此目的。我有一个问题导致同样的错误,但是由于我的实体生活在使用PSR-4的代码库中。在做代码生成的时候,学说不支持PSR-4。它与它们如何将类命名空间映射到文件系统路径以及PSR-4如何允许不直接映射到文件系统的类/命名空间路径有关。
Just to add something else in case others reach this. I had an issue causing the same error but it was due to my entities living in a codebase that used PSR-4. Doctrine does not support PSR-4 when doing anything with code generation. It has to do with how they map class namespaces to filesystem paths and how PSR-4 allows class/namespace paths that don't directly map to the filesystem.
https://github.com/doctrine/DoctrineBundle/issues/282
这篇关于不能找到捆绑的基本路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!