我在控制器中有以下代码。我可以排除除Claim.number
和Payer.abbr
之外的所有字段。任何人都知道为什么会这样?cakephp分页只在一些列上排序
$this->paginate = array(
'fields' => array(
'PaymentException.*', 'Procedure.id', 'Procedure.cpt',
'Procedure.expected_amount', 'Procedure.allowed_amount', 'Procedure.difference_amount',
'Claim.id', 'Claim.number', 'Payer.abbr'
),
'limit' => 50,
'joins' => array(
array(
'table' => 'procedures',
'alias' => 'Procedure',
'conditions' => array('Procedure.id = PaymentException.procedure_id')
),
array(
'table' => 'claims',
'alias' => 'Claim',
'conditions' => array('Claim.id = Procedure.claim_id')
),
array(
'table' => 'payers',
'alias' => 'Payer',
'conditions' => array('Payer.id = Procedure.payer_id')
),
array(
'table' => 'groups',
'alias' => 'Groups',
'conditions' => array('Groups.id = Claim.group_id')
),
array(
'table' => 'exception_workflow_logs',
'alias' => 'ExceptionWorkflowLog',
'conditions' => array('ExceptionWorkflowLog.exception_id = PaymentException.id')
)
),
'conditions' => $conditions
);
所有领域都在视图中进行,如:
<?php echo $this->Paginator->sort('Claim', 'Claim.number'); ?>
我看到他们在URL,但它从来没有通过排序或Claim.number
Payer.abbr
。我不明白为什么会这样。
在我的条件阵列我有:
array
0 => string 'Procedure.difference_amount < 0' (length=31)
1 => string 'PaymentException.finalized IS NULL' (length=34)
注意,条件阵列保持不变,即使在列那种正常。
获取生成的sql并确保它是正确的。尝试在phpmyadmin或其他工具中运行该查询以查看它是否有效。 – tigrang
看着SQL输出,它是不正确的。我试着按'Claim.number'进行排序,输出中没有'ORDER BY'。 – tubaguy50035
$ conditions数组是什么? –