我正在开发cakephp,我正在尝试通过查找查询按顺序查看数据。但它显示的错误类似于“未找到列:1054未知列”处理。 status'in'order clause'“。我正在给我的模型和控制器代码:
型号:
class ClubTable extends AppModel {
var $name = 'ClubTable';
var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Club' => array(
'className' => 'Club',
'foreignKey' => 'club_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Category' => array(
'className' => 'Category',
'foreignKey' => 'category_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
var $hasMany = array(
'Booking' => array(
'className' => 'Booking',
'foreignKey' => 'club_table_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Deal' => array(
'className' => 'Deal',
'foreignKey' => 'club_table_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
以下是我的控制器代码:
$this->Paginator->settings = array(
'conditions' => array('ClubTable.club_id' => $club_id,
'ClubTable.status' => 'approved'),
'order' => array('Deal.status' => 'DESC')
);
$clubTables = $this->Paginator->paginate('ClubTable');