コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Contactos::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['idcontacto' => $this->idcontacto, 'fecha_reunion' => $this->fecha_reunion, 'empresas_id' => $this->empresas_id]);
     $query->andFilterWhere(['like', 'puesto', $this->puesto])->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'correo', $this->correo])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'asistente', $this->asistente]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Obtiene el listado de todos los contactos del modelo de Contacto
  * @return \yii\db\ActiveQuery
  */
 public function getContactos()
 {
     return $this->hasMany(Contactos::className(), ['empresas_id' => 'idempresa']);
     //         return $this->hasOne(Contactos::className(), ['empresas_id'=>'idempresa']);
 }
コード例 #3
0
 /**
  * Finds the Contactos model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Contactos the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Contactos::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }