【发布时间】:2011-12-19 01:59:22
【问题描述】:
我正在尝试为我的 Doctrine Mongo 文档类生成 getter/setter。
文档代码如下所示:
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;
}
但是,当我尝试使用 CLI command php app/console doctrine:mongodb:generate:documents SiteGameBundle 生成 getter 和 setter 时,我得到以下信息:
[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?
这个让我很难过,因为从命名空间的角度来看,我认为我已经正确地包含了所有内容。
【问题讨论】:
标签: php mongodb doctrine symfony