[DDC-1637] Linq-like Filter API for collections Created: 06/Feb/12  Updated: 09/Jul/12  Resolved: 09/Jul/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: 2.3
Security Level: All

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 6
Labels: None


 Description   

We want an API that allows users to filter collections to subsets on the SQL level during the runtime (not using DQL).

Example:

class Post
{
   private $comments;
   public function getRecentComments()
   {
       return $this->comments->select(Expression::lessThan("commentDate", new \DateTime("-7 days")));
   }
}

The language of this Expressions for selecting entities out of a collection has to be so simple that it works on both arrays and any persistence backed data-source.

The Collection#select() method would return a new collection that is not equal the invoked collection.



 Comments   
Comment by Benjamin Eberlei [ 08/Feb/12 ]

First API example: https://gist.github.com/1766769

Comment by Benjamin Eberlei [ 16/Mar/12 ]

There is a PR now https://github.com/doctrine/common/pull/117

Comment by Benjamin Eberlei [ 09/Jul/12 ]

Implemented

Generated at Sat Dec 20 02:25:03 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.