вторник, 22 февраля 2011 г.

Symfony: doctrine custom sql order

    $this->data = Doctrine_Query::create()
->from('Category c')
->innerJoin('c.Product p')
->whereIn('c.slug', array('cpu', 'mainboards', 'ram', 'hdd', 'videocards', 'cases'))
->addWhere('p.is_published = ?', true)
->addOrderBy('FIELD(c.slug, "cpu", "mainboards", "ram", "hdd", "videocards", "cases")')
->execute()
;

Комментариев нет: