Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AdTransport::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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(['id' => $this->id, 'transport' => $this->transport, 'deal_type' => $this->deal_type, 'id_car_model' => $this->id_car_model, 'mileage' => $this->mileage, 'measurement_of_mileage' => $this->measurement_of_mileage, 'price' => $this->price, 'price_for_the_period' => $this->price_for_the_period, 'condition' => $this->condition, 'images_label' => $this->images_label]);
     $query->andFilterWhere(['like', 'video_link', $this->video_link])->andFilterWhere(['like', 'model_scenario', $this->model_scenario]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Finds the AdTransport model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AdTransport the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AdTransport::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAdTransports()
 {
     return $this->hasMany(AdTransport::className(), ['id_car_model' => 'id_car_model']);
 }
Ejemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAdTransports1()
 {
     return $this->hasMany(AdTransport::className(), ['transport' => 'id']);
 }