Cakephp 分页仅在某些列上排序



我在控制器中有以下代码。 我可以按除Claim.numberPayer.abbr以外的所有字段进行排序。 有人明白为什么会这样吗?

$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.numberPayer.abbr排序。 我不明白为什么会这样。

在我的条件数组中,我有:

array
  0 => string 'Procedure.difference_amount < 0' (length=31)
  1 => string 'PaymentException.finalized IS NULL' (length=34)

请注意,即使在正确排序的列上,条件数组也保持不变。

不能将联接和可包含一起使用。您将需要删除包含并使用联接或在第二个查询中获取包含的记录。

最新更新