I got 2 tables, Devices and Locations.
Each device HAS_MANY Locations.
But i want to get the last known location via a relation inside the Devices table:
'location' => array(self::HAS_MANY, 'Location', 'DeviceID','limit'=>1,'order'=>'Time ASC')
But this gives me an array with 1 element.
I just want the location model, not an array.
I tried this:
'location' => array(self::HAS_ONE, 'Location', 'DeviceID','order'=>'Time ASC')
It works, but the sql generated gives me ALL locations and the relation only return the first one found.
When i add
'limit'=>1I get an error:
Property "CHasOneRelation.limit" is not defined.
Why can't I use limit with HAS_ONE?