cakephp/cakephp — pull request #4466 by lorenzo (2014-09-02 17:17:25+00:00)
Title: 3.0 issue 4454

Fixes #4454

This fixes a problem where using duplicate aliases in the joinable
associations chain would end up confusing the ResultSet groupResult
method. The problem cause was that EagerLoader assumed that collision
would occur in certain order.

Instead of relying on the order, a collisions map is generated and
then traversed so that fetching strategies can be corrected. A downside
of this is that it relies on keeping references to arrays.

A future enhancement to this fix would be to convert the arrays to objects
so that the reference handling happen implicitly.