-2
有人可以帮我解释一下如何在条件参数条件中应用if语句来编写cakephp查询。请看下面的例子:if cakephp条件中的else条件参数
$customerList = $this->Asset->find("list", array(
"conditions" => array(
"AUser.status" => 1,
'Asset.warranty_status_id' => $warranty_status_id
),
"fields" => array("AUserProfile.user_id", "AUserProfile.company_name"),
'joins' => array(
array(
'alias' => 'AUser',
'table' => 'users',
'type' => 'LEFT',
'conditions' => array(
'Asset.user_id = AUser.user_id',
'Asset.status = 1',
)
),
array(
'alias' => 'AUserProfile',
'table' => 'user_profiles',
'type' => 'LEFT',
'conditions' => array(
'AUser.user_id = AUserProfile.user_id',
)
)
),
"order" => "AUserProfile.company_name ASC",
"recursive" => $recursive
)
);
我需要在条件数组块中写条件。
你能提供你想要的原始查询吗?这样我们可以使用cakephp进行相同的查询。 –