1

大家好,我实际上对教义(Symfony2 项目)有疑问,所以实际上我有一个文档“问题”,它引用了“$ ref”标签,这是“类别”文档中的一个标签,但我遇到了我无法理解的错误. 我在教义文档中搜索但没有找到解决方案,这是代码:

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


/**
  *@MongoDB\Document(repositoryClass="ATS\QuizzBundle\Document\CategoryRepository")
*/

class Category {

/**
 * @MongoDB\Id
*/
protected $id;

/**
 * @MongoDB\String
*/
protected $label;

/**
 *@MongoDB\int
 *@ReferenceMany(targetDocument="Question")
*/
protected $ref ;
}

我收到了这个错误:

  [Semantical Error] The annotation "@MongoDB\Document" in class ATS\QuizzBun  
  dle\Document\Category was never imported. Did you maybe forget to add a "us  
  e" statement for this annotation?
4

1 回答 1

1

这里正确的注释是@MongoDB\ReferenceMany.

于 2015-04-14T12:01:44.127 回答