I'm hoping I won't need to resort to custom queries.
A related question would be: how do I retrieve data so that if an associated model is empty, no record is retrieved at all, as opposed to an empty array for an associated model?
As an oversimplified example, say I have the following models: City --> Street --> House
How do I sort City results by House numbers?
How do I retrieve City restuls that have at least one House in it? I don't want a record with a city name and details and an empty House array as it messes up pagination results.
CakePHP retrieves House records belonging to the Street in a separate query, so putting somthing like 'House.number DESC' into the 'order' field of the search query returns a 'field does not exist' error.
Any ideas?