'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], ]; } /** * @inheritdoc */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = AccountState::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => false, ]); $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->orderBy(['created_at' => SORT_DESC]); $query->andFilterWhere([ 'id_user' => $this->id_user, 'id_account' => $this->id_account, 'type' => $this->type, ]); $query->andFilterWhere([ '>=', 'created_at', $this->timestampStart ] ); $query->andFilterWhere([ '<', 'created_at', $this->timestampEnd ] ); return $dataProvider; } }