如何按默认降序排序cakephp对表进行排序

时间:2015-10-13 03:57:31

标签: php mysql sorting cakephp

我想知道如何仅在该页面中对表头进行排序而不对整个表进行排序。这在cakephp中是否可能?

这是我的观点:

<?php
                echo   $url = $this->Paginator->sort('ID', 'id',array('direction' => 'desc'));
                $arrow = getArrow($url);
              ?>

这是我的控制者:

$this->paginate = Set::merge($this->paginate, array('OrderFinalized' => array(


                        'limit'=>4,
                        'conditions' => $condition_ary,
                                'joins' => array(
                                    array(
                                        'table' => 'order_entry_headers',
                                        'alias' => 'OrderEntryHeaders2',
                                        'type' => 'inner',
                                        'foreignKey' => false,
                                        'conditions' => array('OrderEntryHeaders2.id = OrderFinalized.order_entry_headers_id'),

                                            'order' => array(
'OrderEntryHeaders2.id'=> 'desc'
 )
                ),

$result = $this->OrderEntryHeader->query("SELECT (value+1) as val FROM order_entries_seq ORDER BY OrderEntryHeader.id desc ");

0 个答案:

没有答案