Let’s say we have 3 models: Alpha, Beta & Gamma.
From an action in GammaController, we need to paginate the results that would be obtained with the query:
select a.user_id, MAX(b.amount) as max_amount from alpha a left join beta b on (b.alpha_id = a.id) group by a.user_id order by max_amount desc;
The best result would be allowing the user to sort the result by any column.
Is this posible using CakePHP 2? If so, how?