public function existe_cedula($atributo, $params) { $usuario = Usuarios::findBySql("SELECT * FROM usuarios WHERE cedula = '" . $this->cedula . "'")->all(); if ($usuario == null) { return true; } else { $this->addError($atributo, 'La cedula ya esta registrada'); } /* $opciones = Usuarios::find()->asArray()->all(); $array = ArrayHelper::map($opciones, 'cedula', 'nombre'); $return = false; foreach($array as $value){ if($this->cedula == $value->cedula){ $this->addError($atributo, 'La cedula ya esta registrada'); return true; } }*/ return false; }