Doctrine MappedSuperclass 和唯一约束

Doctrine MappedSuperclass and unique constraints

我有一个场景,我需要使用 Doctrine 的 MappedSuperclass 功能(使用 Symfony2),并在一些超类列上创建一个唯一约束。比方说:

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\MappedSuperclass
 */
class Base
{
    /**
     * @ORM\Column(type="integer", nullable=false)
     */
    private $someColumn;
}

/**
 * @ORM\Entity
 * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="column_idx", columns={"someColumn"})})
 */
class Concrete extends Base
{
}

问题出在模式生成期间处理@ORM\Table 注释:

[Doctrine\DBAL\Schema\SchemaException]                          
There is no column with name 'someColumn' on table 'Concrete'.

有没有办法定义映射超类的唯一约束?

由于回答作者没有post自己回答,所以引用他的话:

Try to use protected instead of private for entity field. You should always use protected or public for entity fields