Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1241

Additional parameters for EntityRepository::findAll() and EntityRepository::findOneBy()

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.3.1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      In the Doctrine 2.1 versions the method EntityRepository::findBy() accepts additional parameters for ordering, limit and offset.
      Great feature! (While waiting for it I extended the EntityRepository class and implemented these parameters myself using a QueryBuilder.)

      It would be nice for the method EntityRepository::findOneBy() to accept an additional parameter for ordering as well. It could use the following signature:
      public function findOneBy(array $criteria, array $orderBy = null);
      This would be useful for various cases, for example: finding the newest blog-post.

      And maybe update EntityRepository::findAll() as well with the signature:
      public function findAll(array $orderBy = null);

      Looking forward to your thoughts.

        Activity

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Jasper N. Brouwer
          • Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: