Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Cuentas::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->joinWith(['idEmpresa', 'idTercero']);
     //$this->load($params);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     //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(['id_cuenta' => $this->id_cuenta, 'fecha' => $this->fecha, 'valor' => $this->valor])->andFilterWhere(['LIKE', 'empresa.nombre', $this->id_empresa])->andFilterWhere(['LIKE', 'terceros.nombre', $this->id_tercero]);
     return $dataProvider;
 }