cakephp/cakephp — pull request #5410 by lorenzo (2014-12-13 22:40:44+00:00)
Title: 3.0 - Allow matching() and contain() on the same alias

One of the most annoying limitations of the ORM was that it was impossible to both filter by an association and get all records for it using `contain()`.

This PR solves this limitation, but has the side effect that any data generated by `matching()` will be put into a separate key into the results:

Before:

```php
['id' => 1, 'name' => 'Foo', 'tags' => ['id' => 100, 'name' => 'Cake']]
```

```php
['id' => 1, 'name' => 'Foo', '_matchingData' => ['Tags' => ['id' => 100, 'name' => 'Cake']]]
```

Personally, I think this is good change as the way data from `matching()` was nested made absolutely no sense with the rest of what the ORM did for returning results. To be honest, that inconsistency was for me one of the sad parts of the library.

Also closes #5381, #5214 and #3457