/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ContactosIp::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); // Se comenta esta línea para mostrar solo los contactos de la cuenta al hacer uso de ExpandRowColumn //$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, 'cuentas_ip_id' => $this->cuentas_ip_id]); $query->andFilterWhere(['like', 'puesto', $this->puesto])->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'correo', $this->correo]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getContactosIps() { return $this->hasMany(ContactosIp::className(), ['cuentas_ip_id' => 'id']); }
/** * Finds the ContactosIp model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ContactosIp the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ContactosIp::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }