问题描述:

I'm having trouble with a Doctrine 2 mapped superclass, to define a ManyToMany Relation.

My code is :

use Doctrine\Common\Collections\ArrayCollection;

/** @MappedSuperclass */

abstract class MyAbstractClassA

{

/**

* @Id

* @GeneratedValue

* @Column(type="integer")

* @var int

*/

protected $id;

/**

* @ManyToMany(targetEntity="MyClassE")

* @var MyClassE[]

*/

protected $my_class_es;

// ... Other fields and methods

}

/** @Entity() */

class MyConcreteClassAa extends MyAbstractClassA

{

/**

* @Column(type="string")

* @var string

*/

public $aa_param;

// ... Other fields and methods

}

/** @Entity() */

class MyConcreteClassAb extends MyAbstractClassA

{

/**

* @Column(type="string")

* @var string

*/

public $ab_param;

// ... Other fields and methods

}

/** @Entity() */

class MyClassE

{

/**

* @Id

* @Column(type="integer")

* @var int

*/

protected $id;

/**

* @Column(type="string")

* @var string

*/

protected $e_param;

/**

* @ManyToOne(targetEntity="MyClassF")

* @var MyClassF

*/

protected $my_class_f;

// ... Other fields and methods

}

/** @Entity() */

class MyClassF

{

/**

* @Id

* @Column(type="integer")

* @var int

*/

protected $id;

// ... Other fields and methods

}

So here is the schema of what i have : http://pix.toile-libre.org/upload/original/1385651287.png

And there is what i want : http://pix.toile-libre.org/upload/original/1385651300.png

I don't know how to obtain this result, could someone tell me if it's possible ?

Thank you for helping me.

相关阅读:
Top