spotorm / spot2

Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer
http://phpdatamapper.com
BSD 3-Clause "New" or "Revised" License
601 stars 101 forks source link

Prevent some query methods to break relations #296

Open Arzaroth opened 4 years ago

Arzaroth commented 4 years ago

If one uses methods from the Query class that don't return the Query object through __call when dealing with a relation object, it becomes unusable.

This PR aims to fix that.

The test provided illustrate one of the cases in which this could happen (namely, ordering a hasMany relation before retrieving the first item).