cakephp/cakephp — pull request #1544 by lorenzo (2013-08-20 22:14:52+00:00)
Title: 3.0 finders

This lays down the architecture for having custom finders in the Table objects. You will find them very similar to our `_findMethod($state, $query, $results = [])` from 2.x.

A major difference is that they now take only 2 params: The query object and an optional array for custom settings. Finders can be called directly on the table, for example `$table->list()` or as we are used to from 2.x `$table->find('list')`

Another major difference is that finders must always return a query object, never the results, this makes it non-obvious for some developers that want to run afterFind logic. For this purpose I have added a MapReduce class, one that I hope will cover all usual cases for using afterFind. For those wanting afterFind at the record level, they can use the Entity classes that we will introduce at a later point.

I have implemented `find('list')` and `find('threaded')` using the MapReduce approach to showcase this functionality. Please do not mind much the specific implementation of this 2 finders as I know they are still incomplete.