cakephp/datasources — pull request #112 by albertboada (2014-10-08 11:58:37+00:00)
Title: Patches ArrayDatasource by disabling fields-filtering, fixing broken results on hasMany/HABTM scenarios

Patches Array Datasource by disabling fields-filtering feature, since it was not behaving properly when querying hasMany/HABTM related models (see commit code for detailed explanation).

> The reason for this patch lies on a strange behaviour in CakePHP 1.3.X's DBO Datasource (https://github.com/cakephp/cakephp/blob/1.3/cake/libs/model/datasources/dbo_source.php#L1230), where `$queryData['fields']` is polluted with a fields list from the root model when querying its `hasMany/HABTM` relationships, thus affecting all queries on the following related models (since `$queryData` is passed by reference).
> This pollution affected the following bit of code in a way that, if no `fields` for the current relationship were initially specified by the developer, it would unset ALL of them, giving inconsistent results.
> Since trying to fully understand all the side effects that changing CakePHP's DBO Datasource would carry, and since field-filtering makes almost no sense in terms of optimization on Array Datasources (unlike in SQL), this patch consists in ignoring field-filtering on Array Datasource's models.

Any experience on this scenario, anyone?