My most painful place in CakePHP is pagination. Especially when it comes to tricks. Banal -> find ('all') always works (well, almost always) well and well, but pagination ...
Given:
There is a sign of real estate (Immovable) with a specified price (Immovable.price) and type of currency (Immovable.currency_id)
There is a currency plate (Currency) with fields: id, name, coeff (coefficient)
Accordingly, in the currency table there are coefficients USD coeff = 1, for the currency Euro coeff = 1.34.
Task:
Sort the issue (paginate) by price, taking into account the currency. Those. a house for 100,000 euros is more expensive than a house for 110,000 dollars (with a rate of 1 to 1.34)