开发者

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;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜