Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2217

Return a lazy collection from PersistentCollection::match($criteria)

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:

      Description

      In 2.3, PersistentCollection::match() has been implemented by doing the query directly. But sometimes, the only meaningful information about the matched collection would be its length. In this case, it would be great to handle it in the same way than extra lazy collections are handled: the matched collection would be initialized lazily, and could do the count in an extra lazy way (if the original collection was extra lazy).
      This would of course not change anything in the case where the original collection was already initialized.

        Activity

        Christophe Coevoet created issue -
        Marco Pivetta made changes -
        Field Original Value New Value
        Priority Minor [ 4 ] Major [ 3 ]
        Maciej Klemarczyk made changes -
        Labels collection
        Hide
        Maciej Klemarczyk added a comment -

        It will be very usefull, for example to compute count of rows.

        In 300 rows, you do not want fetch data from database to compute length of this.

        Function matching(Criteria $criteria) fetch too many data for just compute count of rows.

        Show
        Maciej Klemarczyk added a comment - It will be very usefull, for example to compute count of rows. In 300 rows, you do not want fetch data from database to compute length of this. Function matching(Criteria $criteria) fetch too many data for just compute count of rows.
        Hide
        Christophe Coevoet added a comment -

        This is exactly the use case I add in mind actually

        Show
        Christophe Coevoet added a comment - This is exactly the use case I add in mind actually
        Michaël Gallego made changes -
        Comment [ +1 on this one! This is really something that prevents me to use Criteria API! ]
        Hide
        Michaël Gallego added a comment -

        +1 on this one! This is absolutely needed when we use the Selectable API as the abstraction for some libraries.

        Show
        Michaël Gallego added a comment - +1 on this one! This is absolutely needed when we use the Selectable API as the abstraction for some libraries.

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2217, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Christophe Coevoet
          • Votes:
            8 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated: