字段或鉴别器列映射中实体 'Acme\ApiBundle\Entity\Client' 上列 'random_id' 的重复定义

Duplicate definition of column 'random_id' on entity 'Acme\ApiBundle\Entity\Client' in a field or discriminator column mapping

我创建了扩展 FOSOAuthServerBundle 的客户端。该客户端的代码如下:

<?php 
namespace Acme\ApiBundle\Entity;
use FOS\OAuthServerBundle\Entity\Client as BaseClient;
use Doctrine\ORM\Mapping as ORM;
 /**
 * Class Client
 *
 * @package Acme\ApiBundle\Entity
 *
 * @ORM\Table("oauth2_clients")
 * @ORM\Entity
 */
class Client extends BaseClient
{
/**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 */
protected $id;
    protected $name;

    public function __construct()
    {
        parent::__construct();
    }
    public function setName($name)
    {
        $this->name = $name;
    }
    public function getName()
    {
        return $this->name;
   }
}

因此,正如我所说,我扩展了具有 $randomId 的 FOSOAuthServerBundle(\friendsofsymfony\oauth-server-bundle\Entity\Client.php,第 28 行)。现在我得到一个错误:

MappingException in MappingException.php line 565: Duplicate definition of column 'random_id' on entity 'Acme\ApiBundle\Entity\Client' in a field or discriminator column mapping.

我哪里搞错了?

当我使用 FOS\OAuthServerBundle\Entity\Client 时,我使用 class 扩展另一个目标 class (FOS\OAuthServerBundle\Model\Client)。有目标变量,例如我发现重复的 $RandomId。因此,根据我的观点,随着 Acme\ApiBundle\Entity\Client 扩展 FOS\OAuthServerBundle\Entity\Client 扩展 FOS\OAuthServerBundle\Model\Client,我们得到了两次变量而不是一次。所以我决定直接扩展 FOS\OAuthServerBundle\Model\Client 它解决了我的问题。谁能解释一下为什么不可能以这种方式编写代码?