Doctrine2映射ID而不是实体的数组

时间:2016-06-02 07:24:54

标签: doctrine-orm

是否可以创建从一个实体A到实体B的映射,而只是在实体A中存储一个只包含相关实体B的ID的数组。

class A
{
    /**
     * @var int
     */
    protected $id;
    /**
     * @var int[]    One to many relationship which only has the ID's of class B
     */
    private $bIds;

    ...
}

class B
{
    /**
     * @var int
     */
    protected $id;
    /**
     * @var A    Many to one relationship
     */
    private $a;
}

0 个答案:

没有答案