2017-06-21 10 views
1

私はFOS_Userエンティティにpasswordフィールドをオーバーライドし、この方法:無効なフィールドの上書きが

* @ORM\AttributeOverrides({ 
    * @ORM\AttributeOverride(name="password", 
    *  [email protected]\Column(
    *  nullable=true 
    * ) 
    * ) 
    * }) 

./app/console doctrine:schema:validateチェックが細かいです:

[Mapping] OK - The mapping files are correct.

[Database] OK - The database schema is in sync with the mapping files.

しかし、私はgenerate:doctrine:entitiesコマンドを実行すると次のエラーが表示されます。

Invalid field override named 'password' for class 'MyAppBundle\Entity\User'.

私の設定に何が間違っていますか?

答えて

0

これを試してみてください。オーバーライドが教義のバージョンからサポートされているので、

/** 
* User 
* @ORM\Entity 
* @ORM\AttributeOverrides({ 
    * @ORM\AttributeOverride(name="password", 
    *  [email protected]\Column(
    *  nullable=true 
    * ) 
    * ) 
    * }) 
*/ 
class yourUser extends BaseUser 
{ 
    /** 
    * @ORM\password() 
    * @ORM\Column(type="string") 
    */ 
    protected $password; 

    //other code 
} 

は(2.3​​

+1

@ORMの\パスワード教義の最新バージョンを使用してください)が認識されない: '[意味論的エラー] My \ AppBundle \ Entity \ User :: $プロパティの "@Doc​​trine \ ORM \ Mapping \ password"アノテーションが存在しないか、または自動ロードできませんでした "私はSymfony 2.5を使用しています。 vendor/doctrine/orm/lib/Doctrine/ORM/Mapping / – anthony

関連する問題