Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDC-2217: Return a lazy collection from PersistentCollection::match($criteria) #2914

Closed
doctrinebot opened this issue Dec 31, 2012 · 5 comments
Assignees
Milestone

Comments

@doctrinebot
Copy link

Jira issue originally created by user stof:

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.

@doctrinebot
Copy link
Author

@doctrinebot
Copy link
Author

Comment created by maciekpak:

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.

@doctrinebot
Copy link
Author

Comment created by stof:

This is exactly the use case I add in mind actually

@doctrinebot
Copy link
Author

Comment created by bakura:

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

@doctrinebot
Copy link
Author

Issue was closed with resolution "Fixed"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants