public function search($params) { $query = StoreGroup::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['group_id' => $this->group_id]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getGroup() { return $this->hasOne(StoreGroup::className(), ['group_id' => 'group_id']); }
/** * Finds the StoreGroup model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return StoreGroup the loaded model * @throws HttpException if the model cannot be found */ protected function findModel($group_id) { if (($model = StoreGroup::findOne($group_id)) !== null) { return $model; } else { throw new HttpException(404, 'The requested page does not exist.'); } }
protected function setSubData() { $this->subData['usersData'] = $this->module->getUsersArray(); $this->subData['orderStatuses'] = OrderStatus::getOrderStatusArray(); $this->subData['orderAttributes'] = OrderAttribute::getAttributesArray(); $this->subData['storeGroups'] = StoreGroup::getStoreGroupsArray(); }