I wrote this, but i think it is wrong way.
$lastPointContent = $dm->createQueryBuilder('PointContent')
->sort('pageNumber','desc')->limit(1)->getQuery()->getSingleResult();
I can't find any other way to making it look better.
I wrote this, but i think it is wrong way.
$lastPointContent = $dm->createQueryBuilder('PointContent')
->sort('pageNumber','desc')->limit(1)->getQuery()->getSingleResult();
I can't find any other way to making it look better.
I don't know exactly about the syntax for doctrine-odm or PHP regarding Mongo but it seems to me that what you must do is:
Seems like you are perfoming that right as for mongo there's not a max() for a whole query as SQL has. max in MongoDB stands for limiting the query to an upper bound.
tl;dr: the approach you described is correct IMO.
Let me know if I stated something wrong