我想在映射的超类CommonResource
与实体Author
之间建立多对多关联。我们正在使用教义手册提供的关于以下主题的语法:association override doctrine。但是,当我使用php bin/console doctrine:schema:val
验证教义模式时,会出现以下错误:
[Mapping] FAIL - The entity-class 'AppBundle\Entity\Author' mapping is invalid:
* The association AppBundle\Entity\Author#entities refers to the owning side field AppBundle\Entity\CommonResource#authors which does not exist.
我有一个映射的超类CommonResource
:
/**
* Class CommonResource
* @ORM\MappedSuperclass()
* @ORM\HasLifecycleCallbacks
*/
class CommonResource
{
...
/**
* @var
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Author", inversedBy="entities")
*/
protected $authors;
}
还有实体Author
:
/**
* Author
*
* @ORM\Table(name="author")
* @ORM\HasLifecycleCallbacks
*/
class Author
{
...
/**
* @var
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\CommonResource", mappedBy="authors")
*/
protected $entities;
}
某些具有扩展的映射超类的实体,例如:
/**
* Itinerary
*
* @ORM\Table(name="itinerary")
* @ORM\Entity(repositoryClass="AppBundle\Repository\Itinerary\ItineraryRepository")
* @ORM\AssociationOverrides({@ORM\AssociationOverride(name="authors", joinTable=@ORM\JoinTable(
* name="common_resource_itinerary",
* joinColumns=@ORM\JoinColumn(name="common_resource_id"),
* inverseJoinColumns=@ORM\JoinColumn(name="itinerary_id")
* ))})
*/
class Itinerary extends CommonResource implements AllowedPermissionInterface, EnrollmentInterface, SluggableInterface, CommonResourceEntityInterface
{
...
}
我是否已正确使用主义语法来与映射的超类进行关联重写,否则出现问题?我将不胜感激:)