Good day. I'm already on my second day and I can not understand what's the matter ... I get the error in runtime:
PHP Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'The target-entity Entity\ItemsBags cannot be found in 'Entity\Players#itemsBag'.' in /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php:762 Stack trace: #0./var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(1028): Doctrine\ORM\Mapping\MappingException::invalidTargetEntityClass('Entity\\ItemsBag...', 'Entity\\Players', 'itemsBag') #1./var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(272): Doctrine\ORM\Mapping\ClassMetadataInfo->validateAssociations() #2./var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(251): Doctrine\ORM\Mapping\ClassMetadataFactory->validateRuntimeMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL) #3./var/www/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(332): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadM in /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php on line 762
When I check the doctrine, and the update, everything goes well:
root@comp:# php vendor/bin/doctrine orm:schema:update --force Updating database schema... Database schema updated successfully! "4" queries were executed
root@comp:# php vendor/bin/doctrine orm:validate-schema [Mapping] OK - The mapping files are correct. [Database] OK - The database schema is in sync with the mapping files.
I tried to clear the cache, delete the proxy and regenerate them, but nothing produced results ...
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
namespace Entity;
use Doctrine\Common\Collections\ArrayCollection;
/**
*
* @Entity
* @Table(name="players")
*
*/
class Players{
...
/**
* @var ItemsBags
*
* @OneToOne(targetEntity="ItemsBags", mappedBy="player")
*/
private $itemsBag;
...
}
ItemsBags.php
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;
...
}
Tell me please, what am I doing wrong?
Thanks to @Sarcoma. I just forgot to specify autoload section in my composer.json
"autoload": {
"psr-4": { "": "core/" }
},
P.S Can enyone me tell, why my project running normal before?) Before I too have many entinties, no have that section in my composer.json, but all works fine.