Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TableThree::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 't4_id' => $this->t4_id]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 public function getTableThreeRecord()
 {
     return $this->hasOne(TableThree::className(), ['id' => 't3_id']);
 }
Exemplo n.º 3
0
/* @var $model app\models\TableOne */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="table-one-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'id')->textInput();
?>

    <?php 
echo $form->field($model, 'three_list')->dropDownList(ArrayHelper::map(TableThree::find()->all(), 'id', 'id'), ['multiple' => true]);
?>


    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Exemplo n.º 4
0
 public function getTableThreeRecords()
 {
     return $this->hasMany(TableThree::className(), ['id' => 't3_id'])->via('tableTwoRecords');
     //->viaTable('table_2', ['t1_id' => 'id']);
 }
 /**
  * Finds the TableThree model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TableThree the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TableThree::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }