如何从JoinTable映射到Doctrine

I have the following tables in my ERM/database:

card, expansion and card_expansion
ManyToMany-Relationship between card and expansion. A card can be in many expansions and an expansion can hold a many of cards.

collection
Description of how many cards from which expansion are needed. Card A from Expansion B is needed 3 times. So there's a OneToMany relationship to card_expansion.

I want to map these relations in my Entities-objects using Doctrine. Mapping between cards and expansions is no problem. But since the card_expansion table isn't mapped directly by an entity, I don't have a clue how to access it from my Collection entity or which annotation I have to use to build up that connection correctly...

What do I need to map to get this working?

Here's the code of my Expansion entity:

/**
 * @Entity
 * @Table(name="expansion")
 */
class Expansion {

...
    /**
     * @ManyToMany(targetEntity="Card")
     * @JoinTable(name="card_expansion",
     *     joinColumns={@JoinColumn(name="_expansion", referencedColumnName="id")},
     *     inverseJoinColumns={@JoinColumn(name="_card", referencedColumnName="id", unique=true)})
     */
    private $cards;

    public function __construct () {
        $this->cards = new ArrayCollection();

    }

and here's my Collection Entity

/**
 * @Entity
 * @Table(name="collection")
 */
class Collection{

 /**
     * @OneToMany(targetEntity="???")
     * @JoinTable(name="card_in_expansion")
     */
    private $card_in_expansion;

You can make the relationship between Card and Expension to an entity CardExpension. Then you will be able to use it in your model.

Instead of having following:

Card - ManyToMany - Expension

You will get:

Card - OneToMany - CardExpension - ManyToOne - Expension

Read also on this here in the Doctrine 2 documentation:

Consequently, the direct many-to-many association disappears and is replaced by one-to-many/many-to-one associations between the 3 participating classes.