Reputation: 388
this is my code:
$role_id = $this->get('session')->get('role_id');
$em = $this->get('doctrine_mongodb')->getManager()->getRepository('AdminBundle:Rolemaster');
$role = $em->createQueryBuilder()->field('rolename')->notEqual('admin')->getQuery()->execute();
var_dump($role);exit; `
this is the image of output:
Please help me
Upvotes: 1
Views: 243
Reputation: 4582
This is the expected behavior as executing a query for Doctrine MongoDB query builder, returns a cursor for you to iterate over the results. You can refer to the documentation here.
If you want to get the result as an array you have to use toArray()
on the cursor:
$role = $em->createQueryBuilder()
->field('rolename')
->notEqual('admin')
->getQuery()->execute()->toArray();
Upvotes: 1