Skip to content

Commit

Permalink
improve to pass domain and resource errors to form object
Browse files Browse the repository at this point in the history
  • Loading branch information
albertborsos committed Jan 25, 2018
1 parent dda5a09 commit 30fe733
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 10 deletions.
5 changes: 0 additions & 5 deletions src/gii/generators/crud/default/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ public function actionCreate()
AlertWidget::addSuccess('<?= $modelClass ?> created successfully!');
return $this->redirect(['view', 'id' => $domain->getId()]);
}

$form->addErrors($domain->getErrors());
}

return $this->render('create', [
Expand Down Expand Up @@ -208,8 +206,6 @@ public function actionUpdate(<?= $actionParams ?>)
AlertWidget::addSuccess('<?= $modelClass ?> updated successfully!');
return $this->redirect(['update', 'id' => $domain->getId()]);
}

$form->addErrors($domain->getErrors());
}

return $this->render('update', [
Expand Down Expand Up @@ -259,7 +255,6 @@ public function actionStatus(<?= $actionParams ?>)
AlertWidget::addSuccess('<?= $modelClass ?> updated successfully!');
return $this->redirect(['index']);
}
$form->addErrors($domain->getErrors());
}
AlertWidget::addError(\yii\bootstrap\Html::errorSummary($form));
return $this->redirect(['index']);
Expand Down
1 change: 0 additions & 1 deletion src/gii/generators/crud/default/domains/create.domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function process()
return true;
}

$this->addErrors($resource->getErrors());
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function process()
return true;
}

$this->addErrors($resource->getErrors());
return false;
}

Expand Down
1 change: 0 additions & 1 deletion src/gii/generators/crud/default/domains/update.domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function process()
return true;
}

$this->addErrors($resource->getErrors());
return false;
}
}
4 changes: 2 additions & 2 deletions src/gii/generators/model/default/resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function insert()
return true;
}

$this->addErrors($model->getErrors());
$this->getForm()->addErrors($model->getErrors());
return false;
}

Expand All @@ -58,7 +58,7 @@ protected function update()
return true;
}

$this->addErrors($model->getErrors());
$this->getForm()->addErrors($model->getErrors());
return false;
}

Expand Down

0 comments on commit 30fe733

Please sign in to comment.