Php 条令映射异常,消息为“在实体\\PlayerItemsBag”中找不到目标实体实体\\ItemsBag”
你好。我已经是第二天了,我不明白怎么回事。。。我在运行时遇到错误: PHP致命错误:未捕获异常 “条令\ORM\Mapping\MappingException”和消息“The” 在中找不到目标实体\ItemsBags 中的“Entity\PlayerItemsBag.” /var/www/vendor/doctrine/orm/lib/doctrine/orm/Mapping/MappingException.php:762 堆栈跟踪: 0./var/www/vendor/doctrine/orm/lib/doctrine/orm/Mapping/ClassMetadataInfo.php1028: 条令\ORM\Mapping\MappingException::invalidTargetEntityClass'Entity\\ItemsBag…', '实体\\玩家','项目标签' 1./var/www/vendor/doctor/orm/lib/doctor/orm/Mapping/ClassMetadataFactory.php272: 条令\ORM\Mapping\ClassMetadataInfo->validateAssociations 2./var/www/vendor/doctrine/orm/lib/doctrine/orm/Mapping/ClassMetadataFactory.php251: 条令\ORM\Mapping\ClassMetadataFactory->ValidateRuntimeMetadataObject条令\ORM\Mapping\ClassMetadata, 无效的 3./var/www/vendor/doctor/common/lib/doctor/common/Persistence/Mapping/AbstractClassMetadataFactory.php332: 条令\ORM\Mapping\ClassMetadataFactory->doLoadM in /var/www/vendor/doctrine/orm/lib/doctrine/orm/Mapping/MappingException.php 在线762 当我检查条令和更新时,一切都很顺利: root@comp:php vendor/bin/orm:schema:update-强制更新 数据库架构。。。数据库架构更新成功!4查询 被处决 root@comp:php vendor/bin/orm:validate schema[Mapping]确定 -映射文件是正确的。[数据库]确定-数据库架构与映射文件同步 我试图清除缓存,删除代理并重新生成它们,但没有任何结果Php 条令映射异常,消息为“在实体\\PlayerItemsBag”中找不到目标实体实体\\ItemsBag”,php,doctrine-orm,backend,Php,Doctrine Orm,Backend,你好。我已经是第二天了,我不明白怎么回事。。。我在运行时遇到错误: PHP致命错误:未捕获异常 “条令\ORM\Mapping\MappingException”和消息“The” 在中找不到目标实体\ItemsBags 中的“Entity\PlayerItemsBag.” /var/www/vendor/doctrine/orm/lib/doctrine/orm/Mapping/MappingException.php:762 堆栈跟踪: 0./var/www/vendor/doctrine/o
root@comp:# php vendor/bin/doctrine orm:clear-cache:metadata
Clearing ALL Metadata cache entries
Successfully deleted cache entries.
root@comp:# php vendor/bin/doctrine orm:clear-cache:query
Clearing ALL Query cache entries
Successfully deleted cache entries.
root@comp:# php vendor/bin/doctrine orm:clear-cache:result
Clearing ALL Result cache entries
Successfully deleted cache entries.
root@comp:# php vendor/bin/doctrine orm:generate-proxies
Processing entity "Entity\Objects"
Processing entity "Entity\Weapons"
Processing entity "Entity\ItemsBags"
Processing entity "Entity\Players"
Processing entity "Entity\Translations"
Processing entity "Entity\Worlds"
Processing entity "Entity\Tiles"
Processing entity "Entity\WorldStructures"
Proxy classes generated to "/tmp"
Players.php
ItemsBags.php
请告诉我,我做错了什么?多亏了@肉瘤。我只是忘了在composer.json中指定自动加载部分
"autoload": {
"psr-4": { "": "core/" }
},
请告诉我,为什么我的项目以前运行正常?在我拥有太多实体之前,我的composer.json中没有该部分,但一切都很好。我会尝试删除@JoinColumn行,看看是否有帮助。这没有效果。您可以尝试使用完全限定的名称:@OneToOnetargetEntity=\Entity\ItemsBags,mappedBy=player和@OneToOnetargetEntity=\Entity\Players,inversedBy=itemsBag。虽然它似乎在那里寻找它们……您是否配置了psr-4根目录?在composer文件中查找psr-4我尝试使用完全限定名,但这也没有效果@我不太明白你的问题。。。我在我的项目中只使用了条令,使用了composer。我喜欢这样:
namespace Entity;
use Doctrine\Common\Collections\ArrayCollection;
/**
*
* @Entity
* @Table(name="item_bags")
*
*/
class ItemsBags{
...
/**
* @var Players
*
* @OneToOne(targetEntity="Players", inversedBy="itemsBag")
* @JoinColumn(name="player_id", referencedColumnName="id")
*/
private $player;
...
}
"autoload": {
"psr-4": { "": "core/" }
},