Example #1
0
 protected function findModel($id)
 {
     if (($model = PartProviderSrok::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PartProviderSrok::find();
     //var_dump($params);die;
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['attributes' => ['providername' => ['asc' => ['providername' => SORT_ASC], 'desc' => ['providername' => SORT_DESC], 'label' => 'Поставщик', 'default' => SORT_ASC], 'cityname' => ['asc' => ['cityname' => SORT_ASC], 'desc' => ['cityname' => SORT_DESC], 'label' => 'Город', 'default' => SORT_ASC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['providername' => $this->providername, 'city_id' => $this->city_id, 'days' => $this->days, 'provider_id' => $this->provider_id]);
     $query->andFilterWhere(['like', 'providername', $this->providername])->andFilterWhere(['like', 'cityname', $this->cityname]);
     //            ->andFilterWhere(['like', 'days', $this->days]);
     return $dataProvider;
 }
Example #3
0
 public function getCitySrok()
 {
     //        var_dump($this->partProviderUsers);die;
     return PartProviderSrok::find()->andWhere(['city_id' => $this->store->city_id, 'provider_id' => $this->provider->id]);
 }
Example #4
0
 public function init()
 {
     $this->city_id = Store::findOne(['id' => $this->store_id])->city_id;
     $this->provider_srok = new ActiveDataProvider(['query' => PartProviderSrok::find()->andWhere(['city_id' => $this->city_id])]);
     $this->provider_user = new ActiveDataProvider(['query' => PartProviderUser::find()->andWhere(['store_id' => $this->store_id])]);
 }
Example #5
0
File: Run.php Project: kd-brinex/kd
 private function getShippingPeriod($provider, $options)
 {
     $shippingPeriod = PartProviderSrok::find()->select('days')->asArray()->where(['city_id' => $this->getCityId($options), 'provider_id' => $this->getProviderId($provider)])->one();
     return $shippingPeriod;
 }