In a repository I have this code:
<?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;
}
}
But it throw this error:
The class 'Doctrine\ODM\MongoDB\Cursor' was not found in the chain configured namespaces AppBundle\Document
What is the problem?
I checked the $cat
, it returns correct category
document.