2016-08-15 4 views
0

FOSOAuthServerBundleを拡張するクライアントを作成しました。このクライアントのコードは以下の通りです:フィールドまたはディスクリミネータのカラムマッピング内のエンティティ 'Acme¥ApiBundle¥Entity¥Client'のカラム 'random_id'の重複定義

<?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; 
    } 
} 

だから、私が言ったように、私は$ランダムID(\ friendsofsymfonyの\のOAuthのサーバー・バンドル\エンティティ\ Client.php、ライン28)がFOSOAuthServerBundleを拡張します。今度はエラーが発生します:

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.

私は間違いを犯しましたか?

答えて

0

FOS\OAuthServerBundle\Entity\Clientを使用したとき、別のターゲットクラス(FOS\OAuthServerBundle\Model\Client)を拡張するクラスを使用しました。私が見つけた$ RandomIdのような目標変数がありました。だから、私の意見では、Acme\ApiBundle\Entity\ClientFOS\OAuthServerBundle\Entity\Client、それはFOS\OAuthServerBundle\Model\Clientに拡張されているので、変数は1回ではなく2回受け取りました。だから私は直接FOS\OAuthServerBundle\Model\Clientを拡張することにしました、そして、それは私の問題を解決します。誰もそのような方法でコードを実行することが不可能である理由を説明することはできますか?

関連する問題