private function deleteComplaint(\User $user) { $data = 'user_id = :user_id'; $param = array(':user_id' => $user->id); if ($this->debug) { echo " ... Complaint: del " . Complaint::model()->count($data, $param) . " \n"; } else { Complaint::model()->deleteAll($data, $param); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Complaint the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Complaint::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionDetail() { $this->render('detail', ['complaint' => Complaint::model()->findAllByAttributes(['to_company_id' => $_GET['id']]), 'company' => Complaint::model()->findByAttributes(['to_company_id' => $_GET['id']])->to_company]); }