cakephp/cakephp — pull request #2339 by markstory (2013-11-17 03:38:42+00:00)
Title: 3.0 ORM improvements

I've started working on the required changes to get the PaginatorComponent working with the new ORM. I've run into enough complications that I had to do a separate set of changes to fix/add some of the missing features. A quick rundown of the things changed:

* I added `Query::total()` to get the total number of rows from a query. I would have called the method `count` but that creates a function expression instead. I'd love to have a better name, but this is what I could come up with. I feel this method is useful as it encapsulates doing a `COUNT(*)` with a given set of joins, conditions, group + having.
* `Query::applyOptions()` now ignores null values. This solves issues when building queries dynamically.
* `Table::hasField` was added. This is useful for providing a simple external interface to check if a table has a specific field without forcing the caller to know about the schema system.
* `ResultSet` is now countable. There were a few places where the results of find were expected to be countable, so it made sense to me that a database resultset could have its length know.
* `ResultSetDecorator` was missing a few methods which caused fatal errors when you combined mapReduce() with first().