/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = COMPANIES::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['COMPANY_ID' => $this->COMPANY_ID]);
     $query->andFilterWhere(['like', 'COMPANY_NAME', $this->COMPANY_NAME]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCOMPANY()
 {
     return $this->hasOne(COMPANIES::className(), ['COMPANY_ID' => 'COMPANY_ID']);
 }
Example #3
0
echo $form->field($model, 'EMAIL_ADDRESS')->textInput(['maxlength' => 45]);
?>

    <?php 
echo $form->field($model, 'PASSWORD')->passwordInput(['maxlength' => 60]);
?>

    <?php 
echo $form->field($model, 'JOINED_DATE')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Enter birth date ...'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
?>


    

    <?php 
echo $form->field($model, 'COMPANY_ID')->dropDownList(ArrayHelper::map(COMPANIES::find()->all(), 'COMPANY_ID', 'COMPANY_NAME'), ['prompt' => '-Choose a Company-']);
//This works WITHOUT $model
//      Html::dropDownList('COMPANY_ID', null,ArrayHelper::map(COMPANIES::find()->all(), 'COMPANY_ID', 'COMPANY_NAME'),['prompt' => '---- Choose a Company ----']);
//This works with $model, but the CSS is off
//      Html::activeDropDownList($model, 'COMPANY_ID',ArrayHelper::map(COMPANIES::find()->all(), 'COMPANY_ID', 'COMPANY_NAME'));
?>
    
    
    <?php 
echo $form->field($model, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]);
?>
    

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
 /**
  * Finds the COMPANIES model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return COMPANIES the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = COMPANIES::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }