2011-12-19 11 views
1

Doctrine Mongoドキュメントクラスのゲッタ/セッタを生成しようとしています。Symfony2 + Doctrine MongoDMドキュメント生成の問題

文書のコードは次のようになります。

[Doctrine\Common\Annotations\AnnotationException]              
    [Semantical Error] The annotation "@ReferenceOne" in property Site\GameBundle\Document\Game::$user was never imported. Did you maybe forget to add a "use" statement for this annotation? 

この1つは持っている:私はCLI command php app/console doctrine:mongodb:generate:documents SiteGameBundleを使用してゲッターとセッターを生成しようとすると、しかし

namespace MySite\GameBundle\Document; 

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; 

use MySite\GameBundle\Document\User; 

/** 
* @MongoDB\Document 
*/ 
class Game { 
    /** 
    * @ReferenceOne(targetDocument="User") 
    */ 
    protected $user; 

    /** @Date */ 
    protected $start_time; 

} 

を、私は戻って、次の取得名前空間の観点から私はすべてが適切に含まれていると思うので、私は困惑した。

答えて

4

doctrine注釈をMongoDB名前空間としてインポートしました。したがって、@MongoDB\ReferenceOne@MongoDB\Documentなど)を使用する必要があります。

関連する問題