How do you remove and add elements to results returned by doctrine's odm. For example,
I have the query
$fruits = $dm->createQueryBuilder('Fruits')
->field('id')->in($fruit_list)
->getQuery()->execute();
$fruits returned is an arrayand then I need to iterate through this array and filter some fruits after some analysis. The shortlisting is not possible through the query builder and I need to return the filtered results.
I wanted to ask how to remove elements from this object returned by odm.
When you are iterating over $fruits
and making your shortlisting decision, create an ArrayCollection and add all the objects that make the cut and return that rather than the cursor.