I have 3 table :
Events:
- id
- typeEvents
- genreEvents
- ...
TypeEvents:
- id
- type
- description
- ...
GenreEvents:
- id
- genre
- description
- ...
So, I want to create a relation-ship between this 3 tables, but i get error mapping message in the profiler:
BISSAP\BenevolesBundle\Entity\Events
The mappings BISSAP\BenevolesBundle\Entity\Events#typeEvents and BISSAP\BenevolesBundle\Entity\TypeEvents#events are inconsistent with each other.
The mappings BISSAP\BenevolesBundle\Entity\Events#genreEvents and BISSAP\BenevolesBundle\Entity\GenreEvents#events are inconsistent with each other.
BISSAP\BenevolesBundle\Entity\TypeEvents
The association BISSAP\BenevolesBundle\Entity\TypeEvents#events refers to the owning side field BISSAP\BenevolesBundle\Entity\Events#typesEvents which does not exist.
BISSAP\BenevolesBundle\Entity\GenreEvents
The association BISSAP\BenevolesBundle\Entity\GenreEvents#events refers to the owning side field BISSAP\BenevolesBundle\Entity\Events#genresEvents which does not exist.
Events.php
class Events
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
*
* @ORM\ManyToOne(targetEntity="TypeEvents", inversedBy="events", cascade={"persist"})
*
*/
private $typeEvents;
/**
*
* @ORM\ManyToOne(targetEntity="GenreEvents", inversedBy="events", cascade={"persist"})
*
*/
private $genreEvents;
/**
*
* @ORM\ManyToOne(targetEntity="BISSAP\UserBundle\Entity\User", inversedBy="events", cascade={"persist"})
*
*/
private $user;
[...]
TypeEvents.php
class TypeEvents
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var ArrayCollection $events
* @ORM\OneToMany(targetEntity="Events", mappedBy="typesEvents", cascade={"persist", "remove", "merge"})
*/
private $events;
[...]
GenreEvents.php
class GenreEvents
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var ArrayCollection $events
* @ORM\OneToMany(targetEntity="Events", mappedBy="genresEvents", cascade={"persist", "remove", "merge"})
*/
private $events;
[...]
I could see in the symfony doc => One-To-Many, Unidirectional with Join Table but I don't want to get an another table to this simple relationship...
what do you think?