我在CakePHP中自定义排序CakePHP中
有一个问题,我有一个数组($ A),其值
Array // in $A
(
[0] => 3
[1] => 4
...
}
控制器内部:
$conditions[]=array('Room.place_id' =>$A,'Room.status'=>'1');
$this->paginate= array(
'limit' =>50,
'recursive' => 2,
'conditions' => $conditions,
);
现在的结果是:
Array
(
[0] => Array
(
[Room] => Array
(
[id] => 1
[place_id] => 1
[type] => place
)
)
[1] => Array
(
[Room] => Array
(
[id] => 2
[place_id] => 3
)
).
...
现在我想ord呃使用$ A值(地点ID)...
我想第一个记录是间[place_id] => 3(因为$ A [0] = 3)
第二记录应该是间[place_id] => 4(因为$一个[1] = 4) 等
我没有看到你试过什么东西。 – Dave
我没有看到提供的信息的解决方案。当然,您可以在视图中使用两个“for”循环进行排序。但是这是一个分页列表,所以应该在查询内进行排序,否则分页将无用。 – pleasedontbelong