2

I have three entities in my project.

First Entity:

class Entity1
{
    /**
     * @ORM\ManyToMany(targetEntity="App\MyBundle\Entity\Entity2", inversedBy="i")
    *
    */
    protected $j;

}

Second Entity:

class Entity2

{

/**
 * @ORM\ManyToMany(targetEntity="App\MyBundle\Entity\Entity1", mappedBy="j")
 */

protected $i;
}

Now i have a manyToMany connection between entity 1 and entity 2, the table look like this.

Tablename: entity1_entity2

Fields: entity1_id, entity2_id

I would like to create a third entity and connect this to the related table entity1_entity2 with a oneToMany relation? How can i do this? Is this use case possible?

smartcoderx
  • 1,021
  • 2
  • 14
  • 32
  • 2
    [No, not immediately possible with Doctrine.](http://stackoverflow.com/questions/3542243/doctrine2-best-way-to-handle-many-to-many-with-extra-columns-in-reference-table) You will have to turn `entity1_entity2` into its own entity and have `entity1` and `entity2` have a Many-to-One relationship with this entity to be able to continue with your third entity. – sjagr Sep 23 '14 at 14:09

0 Answers0