Doctrine2 many-to-many association using sub entity
I have Hotel
entity with many-to-many relationship with an entity Airport
through entity Distanсe
/**
*
* @Table(name="Hotel")
* @Entity
*/
class Hotel
{
/**
* @Column(name="hotel_id", type="integer")
* @Id
* @GeneratedValue(strategy="IDENTITY")
*/
private $hotel_id;
}
/开发者_运维知识库**
*
* @Table(name="Airport")
* @Entity
*/
class Airport
{
/**
* @Column(name="airport_id", type="integer")
* @Id
* @GeneratedValue(strategy="IDENTITY")
*/
private $airport_id;
}
I do not know how to describe the association to the Distance
class?
/**
*
* @Table(name="Distance")
* @Entity
*/
class Distance
{
private $airport_id;
private $hotel_id;
/**
* @Column(name="distance", type="integer")
*
*/
private $distance;
}
精彩评论