Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.3.2
    • Fix Version/s: None
    • Component/s: ORM

      Description

      Hi,

      I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

      However, I've found a problem when I want to paginate data:

      count
      return count($this->selectable->matching(new Criteria()));
      

      The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

      Thanks

        Activity

        Michaël Gallego created issue -
        Marco Pivetta made changes -
        Field Original Value New Value
        Description Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code}
        return count($this->selectable->matching(new Criteria()));
        {/code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code}
        return count($this->selectable->matching(new Criteria()));
        {code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Michaël Gallego made changes -
        Description Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code}
        return count($this->selectable->matching(new Criteria()));
        {code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code:php}
        return count($this->selectable->matching(new Criteria()));
        {/code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Michaël Gallego made changes -
        Description Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code:php}
        return count($this->selectable->matching(new Criteria()));
        {/code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code:xml}
        return count($this->selectable->matching(new Criteria()));
        {/code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Michaël Gallego made changes -
        Description Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code:xml}
        return count($this->selectable->matching(new Criteria()));
        {/code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code}

        return count($this->selectable->matching(new Criteria()));

        {/code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Michaël Gallego made changes -
        Description Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code}

        return count($this->selectable->matching(new Criteria()));

        {/code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Hi,

        I'm currently using intensively the Criteria and Selectable interfaces to provide a generic REST library.

        However, I've found a problem when I want to paginate data:

        {code:title=count}
        return count($this->selectable->matching(new Criteria()));
        {code}

        The problem is that EntityRepository returns an ArrayCollection and, hence, load the whole collection which is inefficient. It would be nice if it could return a PersistentCollection instead with lazy-load and perform an optimized count.

        Thanks
        Marco Pivetta made changes -
        Security All [ 10000 ]
        Hide
        Christophe Coevoet added a comment -

        duplicate of DDC-2217

        Show
        Christophe Coevoet added a comment - duplicate of DDC-2217
        Marco Pivetta made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Resolution Duplicate [ 3 ]
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-882] was closed:
        https://github.com/doctrine/doctrine2/pull/882

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-882] was closed: https://github.com/doctrine/doctrine2/pull/882

        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-2378, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Michaël Gallego
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: