RFC: Add optional orderBy parameter to findAll
In this patch I want to discuss the possibility of adding an optional parameter to the findAll method, that IMO makes sense to be there: $orderBy.
When one needs to fetch the data sorted differently than the default method findAll is of no use and one has to use findBy([], $orderBy), which makes it slightly less readable as there are no filters being applied, but rather it is used only for sorting. Said calls then can be changed to findAll($orderBy)
If the maintainers agree that this is a positive change then I can also send the corresponding PR for doctrine/orm and any documentation changes.
If we make changes to the signature of findAll, I would vote for using the same signature we use for the findBy method, minus the $criteria argument:
public function findAll(array $orderBy = [], $limit = null, $offset = null)
Opinions @doctrine/doctrinecore?
My reasoning for not adding limit and offset is because then it's not technically "all" anymore.
My reasoning for not adding limit and offset is because then it's not technically "all" anymore.
🤦♂️ Um, yeah. That makes sense.