I want to make a many-to-many association between a mapped superclass CommonResource
and an entity Author
. We are using the syntaxis provided by the doctrine manual on this topic: association override doctrine. But when I validate the doctrine schema with php bin/console doctrine:schema:val
I get the following error:
[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.
I have a mapped superclass CommonResource
:
/**
* Class CommonResource
* @ORM\MappedSuperclass()
* @ORM\HasLifecycleCallbacks
*/
class CommonResource
{
...
/**
* @var
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Author", inversedBy="entities")
*/
protected $authors;
}
And an entity Author
:
/**
* Author
*
* @ORM\Table(name="author")
* @ORM\HasLifecycleCallbacks
*/
class Author
{
...
/**
* @var
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\CommonResource", mappedBy="authors")
*/
protected $entities;
}
And some entities with extend the mapped superclass, for example:
/**
* 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
{
...
}
Have I used correctly the doctrine syntaxis for association overrides with mapped superclasses or there is something wrong? I would appreciate any help :)