你能看到错误的家伙吗?我的AND条件被忽略了!我对这些阵列感到非常沮丧..
$transaction_query = $this->Transaction->find('all',[ 'limit' => $countList,'fields' => ['Transaction.client_id','Transaction.name','Transaction.created','Transaction.message_id','Transaction.credit'],'conditions' => ['Transaction.id' => $client_id],'AND' => ['Transaction.name !=' => 'Facturation'] ]);
您的条件必须是[‘Transaction.id’=> $client_id,’Transaction.name!=’=> ‘Facturation’].条件数组的多个条件被解释为“AND”条件.
原文链接:https://www.f2er.com/php/135019.html所以你的查询看起来像: –
$transaction_query = $this->Transaction->find('all',[ 'limit' => $countList,'fields' => [ 'Transaction.client_id','Transaction.credit' ],'conditions' => [ 'Transaction.id' => $client_id,'Transaction.name !=' => 'Facturation' ] ] );
您只需索引,如果您有重复的条件数组键;在您的示例中不是这种情况,因为您有Transaction.id和Transaction.name!=.无论如何,和索引需要是条件数组中的索引,而不是兄弟.