The solution is in the documentation of Doctrine. In the FAQ you can see this :
And the tutorial is here :
http://docs.doctrine-project.org/en/2.1/tutorials/composite-primary-keys.html
So you do not anymore do a manyToMany
but you have to create an extra Entity and put manyToOne
to your two entities.
ADD for @f00bar comment :
it's simple, you have just to to do something like this :
Article 1--N ArticleTag N--1 Tag
So you create an entity ArticleTag
ArticleTag:
type: entity
id:
id:
type: integer
generator:
strategy: AUTO
manyToOne:
article:
targetEntity: Article
inversedBy: articleTags
fields:
# your extra fields here
manyToOne:
tag:
targetEntity: Tag
inversedBy: articleTags
I hope it helps