-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進行相同的查詢。 –