Allow EntityRepository::findAll() method takes parameters for ordering #4989

Closed
opened 2026-01-22 14:55:50 +01:00 by admin · 3 comments
Owner

Originally created by @bocharsky-bw on GitHub (Jan 26, 2016).

Originally assigned to: @Ocramius on GitHub.

I'm going to open a PR that allows ordering objects with EntityRepository::findAll() method:

    public function findAll(array $orderBy = null)
    {
        return $this->findBy(array(), $orderBy);
    }

I think findAll() method should be able to order entities because ordering causes no any effect for the WHERE clause.

What do you think about it?

Originally created by @bocharsky-bw on GitHub (Jan 26, 2016). Originally assigned to: @Ocramius on GitHub. I'm going to open a PR that allows ordering objects with [EntityRepository::findAll()](https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/EntityRepository.php#L163-L166) method: ``` php public function findAll(array $orderBy = null) { return $this->findBy(array(), $orderBy); } ``` I think `findAll()` method should be able to order entities because ordering causes no any effect for the `WHERE` clause. What do you think about it?
admin added the Won't Fix label 2026-01-22 14:55:50 +01:00
admin closed this issue 2026-01-22 14:55:51 +01:00
Author
Owner

@backbone87 commented on GitHub (Jan 26, 2016):

+1

@backbone87 commented on GitHub (Jan 26, 2016): +1
Author
Owner

@Ocramius commented on GitHub (Feb 5, 2016):

Closing as "won't fix" as per #5652

@Ocramius commented on GitHub (Feb 5, 2016): Closing as "won't fix" as per #5652
Author
Owner

@rdstudio commented on GitHub (Dec 27, 2020):

Yes its ridiculous that you can't do a sort on findAll. Every other good programming language does this.

@rdstudio commented on GitHub (Dec 27, 2020): Yes its ridiculous that you can't do a sort on findAll. Every other good programming language does this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4989