Example #1
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $class = $this->model;
     $class = $class::className();
     $models = Address::getAddresses($this->model->id, $class);
     $model = new Address(['scenario' => 'create']);
     $model->entity = $class;
     $model->entity_id = $this->model->id;
     return $this->render('index', ['models' => $models, 'model' => $model]);
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAddresses()
 {
     return $this->hasMany(Address::className(), ['country_id' => 'id']);
 }
 /**
  * Finds the Address model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Address the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Address::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @param Comment $model Comment
  *
  * @return string Comments list
  */
 protected function tree($model)
 {
     $models = Address::getAddresses($model->entity_id, $model->entity);
     return $this->renderPartial('@net/frenzel/address/views/widgets/views/_index_item', ['models' => $models]);
 }