Yii1.1 데이터가 있는지 확인
2402 단어 Yii1.1
//
public function checkExists($data,$id){
$conditionArr = [];
if (!empty($id)){
$conditionArr[] = 'id not in ('.$id.')';
}
if (isset($data['site_id'])){
$conditionArr[] = "site_id = ".$data['site_id'];
}
if (isset($data['account_id'])){
$conditionArr[] = "account_id = ".$data['account_id'];
}
if (isset($data['policy_id'])){
$conditionArr[] = "policy_id = ".$data['policy_id'];
}
$condition = implode(' and ',$conditionArr);
$exists = $this->exists($condition);
return $exists;
}