【问题标题】:ReferenceMany doesn't work Doctrine ODMReferenceMany 不起作用 Doctrine ODM
【发布时间】:2015-06-20 00:02:38
【问题描述】:

大家好,我实际上对教义有疑问(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?

【问题讨论】:

    标签: php mongodb symfony doctrine-orm odm


    【解决方案1】:

    这里正确的注解应该是@MongoDB\ReferenceMany

    【讨论】:

      猜你喜欢
      • 2023-03-23
      • 2012-07-11
      • 2017-08-14
      • 1970-01-01
      • 2015-04-10
      • 1970-01-01
      • 2014-03-20
      • 1970-01-01
      • 2017-08-13
      相关资源
      最近更新 更多