我尝试在Symfony 3.0.1中生成getter和setter
当我运行命令
php bin/console doctrine:generate:entities VendorName/MyBundle/EntityName
我有错误
Namespace "VendorName\MyBundle\EntityName" does not contain any mapped entities.
哪里出错了?
编辑-1:首先生成具有YAML格式的实体
编辑-2:我尝试为供应商包生成getter和setter
另外我尝试使用命令php bin / console doctrine:generate:entities VendorNameMyBundle:EntityName并有另一个错误:
Can't find base path for "VendorName\MyBundle\Entity\EntityName" (path: "/home/site/vendor/vendorname/mybundle/Entity",destination: "/home/site/vendor/vendorname/mybundle/Entity").
解决方法
正如
John Pancoast在他的
answer中指出一个不同的问题:
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.
07002
澄清解决错误消息所需的确切内容;您必须编辑bundle的composer.json文件,并更改bundle的文件夹结构.
在composer.json中将psr-4更改为psr-0:
"autoload": { "psr-4": { "Acme\\Bundle\\AwesomeBundle\\": "" } },
至:
"autoload": { "psr-0": { "Acme\\Bundle\\AwesomeBundle\\": "" } },
更改bundle的文件夹结构:
vendor +--acme +--awesome-bundle |--Controller |--Entity
至:
vendor +--acme +--awesome-bundle +--Acme +--Bundle +--AwesomeBundle |--Controller |--Entity
以下命令将不再抛出异常:
bin/console doctrine:generate:entities AwesomeBundle
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。