MappingException: The target-entity "entity" cannot be found in 'xxx\Entity\User#nhpProductIds'

StackOverflow https://stackoverflow.com/questions/23372840

문제

I have a strange problem only on my production server where the mapping appears to be incorrect. It's working on my development server -- they are both up to date on git.

This is the error I'm getting on production:

[Doctrine\ORM\Mapping\MappingException]
The target-entity Shawmut\ClientBundle\Entity\NHPProductId cannot be found in 'Shawmut\ClientBundle\Entity\User#nhpProductIds'.

From my Entity\NHPProductId:

/**
 * @ORM\ManyToOne(targetEntity="User", inversedBy="nhpProductIds")
 * @ORM\JoinColumn(name="nhp_product_id_users", referencedColumnName="id")
 **/
protected $user;

From my Entity\User:

/**
 * @ORM\OneToMany(targetEntity="NHPProductId", mappedBy="user")
 **/
protected $nhpProductIds;

Can anyone think of what is going wrong here?

EDIT: I was able to solve this by renaming my entity to ProductId instead of NHPProductId. I have no idea why this was causing the Entity to not be loaded, but that was the fix.

도움이 되었습니까?

해결책

This ended up being due to my entity's name. By renaming it to NhpProductId, the problem went away.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top