public function setProviders() { $providers = Providers::find()->all(); foreach ($providers as $objProvider) { $this->_providers[] = $objProvider->getOptionsToArray(); } }
/* @var $model deka6pb\autoparser\models\Providers */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="providers-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($modelOptions, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($modelOptions, 'class')->dropDownList(Providers::getProviders()); ?> <?php echo $form->field($modelOptions, 'OAUTH_TOKEN')->textInput(['maxlength' => true]); ?> <?php echo $form->field($modelOptions, 'count')->textInput(['maxlength' => true]); ?> <?php echo $form->field($modelOptions, 'homepage')->textInput(['maxlength' => true]); ?> <?php
/** * Finds the Providers model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Providers the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Providers::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }