列id必须映射到字段

时间:2013-09-20 11:12:01

标签: php doctrine-orm

刚刚将一些设置更改为学说实体配置并获得以下执行

The column id must be mapped to a field in class VSmart\OrmBundle\Entity\Ob
ject since it is referenced by a join column of another class.

我希望列id不会映射到Object中的字段。但是,请参阅此处特定映射的代码:

/**
 * @var integer
 *
 * @ORM\Column(name="Id", type="integer", nullable=false)
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="IDENTITY")
 */
private $id;

那么,真正试图告诉我的例外是什么?

更新

这是关系的另一端。

对象定义:

/**
     * @var integer
     *
     * @ORM\Column(name="Id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="Address", type="string", length=45, nullable=true)
     */
    private $address;

    /**
     * @var string
     *
     * @ORM\Column(name="Name", type="string", length=45, nullable=true)
     */
    private $name;

    /**
     * @var \Entis
     *
     * @ORM\ManyToOne(targetEntity="Entis",inversedBy="objects")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="EntisId", referencedColumnName="Id")
     * })
     */
    private $entis;

    /**
     * @var \Objecttype
     *
     * @ORM\ManyToOne(targetEntity="ObjectType")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="ObjectType", referencedColumnName="Id")
     * })
     */
    private $objectType;

    /**
     * @var \Unit
     *
     * @ORM\ManyToOne(targetEntity="Unit")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="UnitId", referencedColumnName="Id")
     * })
     */
    private $unit;

    /**
     * @var \Dimension
     *
     * @ORM\ManyToOne(targetEntity="Dimension")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="DimensionId", referencedColumnName="Id")
     * })
     */
    private $dimension;

    /** 
     * @ORM\ManyToMany(targetEntity="Tag") */
    private $tags;

    /**
     * @ORM\OneToMany(targetEntity="Measurement", mappedBy="object")
     */
    private $measurements;

0 个答案:

没有答案