Order by field in cakephp

Rinto George picture Rinto George · Mar 23, 2012 · Viewed 41.5k times · Source

I am doing project in cakephp .

I want to write below query in cakephp Style. I've written 50% . Please help me

$this->Login->find('all')

SELECT * FROM login  
ORDER BY FIELD(profile_type, 'Basic', 'Premium') DESC;

Answer

benji picture benji · Mar 23, 2012

Plese try this

$this->Login->find('all', array(
 'order'=>array('FIELD(Login.profile_type, "basic", "premium") DESC')
));