我在 CakePHP 1.3 文档中读到conditions
参数 forfind()
等同于 SQLWHERE
子句。我正在尝试在 CakePHP 中写这样的东西:
select count(*) from claim
where ((claim_id = X and company_id = W) or (claimant_firstName = Y and claimant_lastName = Z))
但是,我对如何构造conditions
参数感到困惑。
是不是像
find('count', array(
'conditions' => array(
Claim.company_id => $companyId,
Claim.id' => $claimNumber,
'or' => array(
'Claimant.first_name' => $claimantFirstName,
'Claimant.last_name' => $claimantLastName,
)
)
)
);
或者
find('count', array(
'conditions' => array(
'or' => array(
Claim.company_id => $companyId,
Claim.id' => $claimNumber
)
'or' => array(
'Claimant.first_name' => $claimantFirstName,
'Claimant.last_name' => $claimantLastName,
)
)
)
还是完全不同的东西?