开发者

Doctrine2 many-to-many association using sub entity

开发者 https://www.devze.com 2023-01-25 18:58 出处:网络
I have Hotel entity with many-to-many relationship with an entity Airport through entity Distanсe /**

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

精彩评论

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