【发布时间】:2016-10-31 01:51:26
【问题描述】:
在存储库中,我有以下代码:
<?php
namespace AppBundle\Repository;
use Doctrine\ODM\MongoDB\DocumentRepository;
class ItemRepository extends DocumentRepository
{
public function findAllQueryBuilder($filter = '')
{
$qb = $this->createQueryBuilder('item');
if ($filter) {
$cat = $this->getDocumentManager()
->getRepository('AppBundle:Category')
->findAllQueryBuilder($filter)->getQuery()->execute();
$qb->field('category')->includesReferenceTo($cat);
}
return $qb;
}
}
但它会抛出这个错误:
The class 'Doctrine\ODM\MongoDB\Cursor' was not found in the chain configured namespaces AppBundle\Document
有什么问题?
我检查了$cat,它返回正确的category 文档。
【问题讨论】:
-
您可以添加定义实体和 ORM 配置部分的位置吗?这个答案可能会帮助你stackoverflow.com/questions/22813300/…
标签: mongodb symfony doctrine-orm query-builder odm