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 ]
        Marco Pivetta made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Resolution Duplicate [ 3 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: