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