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

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

Frage

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.

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top