/** * Bootstrap method to be called during application bootstrap stage. * Loads all the settings into the Yii::$app->params array * @param Application $app the application currently running */ public function bootstrap($app) { // Get status from database $status = Status::find()->select(['id', 'status'])->asArray()->all(); foreach ($status as $s) { Yii::$app->params['status'][$s['status']] = $s['id']; } // Get crud actions from database /*$status = CrudAction::find()->select(['id', 'action'])->asArray()->all(); foreach ($status as $s) { Yii::$app->params['crud_action'][$s['action']] = $s['id']; }*/ }
/** * @return \yii\db\ActiveQuery */ public function getStatus() { return $this->hasOne(Status::className(), ['id' => 'status_id']); }
?> <?php echo $form->field($modelBook, 'language_id')->dropDownList(BookForm::createArrayMap(Language::className(), 'id', 'name')); ?> <?php echo $form->field($modelBook, 'publisher_id')->dropDownList(BookForm::createArrayMap(Publisher::className(), 'id', 'name')); ?> <?php echo $form->field($modelBook, 'type_id')->dropDownList(BookForm::createArrayMapTranslate(Type::className(), 'id', 'type')); ?> <?php echo $form->field($modelBook, 'status_id')->dropDownList(BookForm::createArrayMapTranslate(Status::className(), 'id', 'status')); ?> <?php echo $form->field($modelBook, 'category_id')->dropDownList(BookForm::createArrayMapTranslate(Category::className(), 'id', 'category_name')); ?> <?php echo $form->field($modelBook, 'library_id')->dropDownList(BookForm::createArrayMap(Library::className(), 'id', 'name')); ?> <?php echo $form->field($modelBook, 'edition')->textInput(); ?> <?php