/**
  * @return \yii\db\ActiveQuery
  */
 public function getBookValues()
 {
     return $this->hasMany(BookValue::className(), ['tour_field_id' => 'id']);
 }
 protected function getReservationFieldsProvider($id)
 {
     $book = \app\models\Book::findOne($id);
     $tourFields = \app\models\TourField::find()->where(['tour_id' => $book->tour_id])->orderBy('position')->all();
     $bookValues = \app\models\BookValue::find()->where(['book_id' => $book->id])->indexBy('tour_field_id')->all();
     //print '<pre>'; print_r($tourFields); die();
     foreach ($tourFields as $field) {
         $data[] = ['name' => $field->name, 'value' => array_key_exists($field->id, $bookValues) ? $bookValues[$field->id]->value : ''];
     }
     //print '<pre>'; print_r($data); die();
     $provider = new \yii\data\ArrayDataProvider(['allModels' => $data]);
     return $provider;
 }