php – Symfony3错误命名空间不包含任何映射实体
我尝试在Symfony 3.0.1中生成getter和setter
当我运行命令 php bin/console doctrine:generate:entities VendorName/MyBundle/EntityName 我有错误 Namespace "VendorNameMyBundleEntityName" 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 "VendorNameMyBundleEntityEntityName" (path: "/home/site/vendor/vendorname/mybundle/Entity",destination: "/home/site/vendor/vendorname/mybundle/Entity"). 解决方法
正如
John Pancoast在他的
answer中指出一个不同的问题:
澄清解决错误消息所需的确切内容;您必须编辑bundle的composer.json文件,并更改bundle的文件夹结构. 在composer.json中将psr-4更改为psr-0: "autoload": { "psr-4": { "AcmeBundleAwesomeBundle": "" } }, 至: "autoload": { "psr-0": { "AcmeBundleAwesomeBundle": "" } }, 更改bundle的文件夹结构: vendor +--acme +--awesome-bundle |--Controller |--Entity 至: vendor +--acme +--awesome-bundle +--Acme +--Bundle +--AwesomeBundle |--Controller |--Entity 以下命令将不再抛出异常: bin/console doctrine:generate:entities AwesomeBundle (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |