public function isIbanUnique($attribute) { $sql = "SELECT * FROM clienti WHERE iban=:param"; $param = array(":param" => $this->{$attribute}); $iban_searched = Clienti::model()->findBySql($sql, $param); //CVarDumper::dump($a,2,true);die(); if ($iban_searched['iban'] === $this->{$attribute}) { $this->addError($attribute, 'Iban esistente!'); return false; } else { return true; } }
public function actionAjax() { $request = trim($_GET['query']); if ($request != '') { $model = Clienti::model()->findAll(array("condition" => "ragione_sociale like '{$request}%'")); foreach ($model as $get) { $value = $get->ragione_sociale; $id = $get->id_cliente; $data[] = array('value' => $value, 'id' => $id, 'label' => $get['id_cliente'], 'template' => $get['ragione_sociale'], 'extra' => array()); // return value from autocomplete } // CVarDumper::dump($data, 10, true); // die(); //$this->layout='empty'; echo json_encode($data); } Yii::app()->end(); }
public function actionClientiEFornitori($c, $f) { $criteria = new CDbCriteria(); //$criteria->with=array('rl_aziende_clienti'); $cliente_searched = Clienti::model()->findByPk($c); $fornitore_searched = Fornitori::model()->findByPk($f); //$clientifedeli= Clienti::model()->malpag()->findAll(); $clientifedeli = TipoOrdine::model()->findAll(); //PROVA METODO FINDALLBYSQL!!! (funzionante) //$sql="SELECT * FROM fornitori WHERE id_fornitore=:param"; //$param=array(":param"=>$f); //$prova= Fornitori::model()->findAllBySql($sql,$param); //CVarDumper::dump($prova,10, true); die(); $fornitori = Fornitori::model()->findAll(); $this->render("esercizio3", array('fornitori' => $fornitori, 'clienti' => $clientifedeli, 'cliente_searched' => $cliente_searched, 'fornitore_searched' => $fornitore_searched)); }
/** * 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 Clienti the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Clienti::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }