Skip to content
Browse files

Fixing non output of flash messages from Scaffolds when controller is…

… not using Sessions. Refs #64
  • Loading branch information...
1 parent 8be5de9 commit c0ba43c884592202930f0b60b17d335ff35cdf66 @markstory markstory committed Aug 31, 2009
Showing with 8 additions and 5 deletions.
  1. +8 −5 cake/libs/controller/scaffold.php
View
13 cake/libs/controller/scaffold.php
@@ -287,7 +287,8 @@ function __scaffoldSave($params = array(), $action = 'edit') {
$this->controller->Session->setFlash(sprintf(__('The %1$s has been %2$s', true), Inflector::humanize($this->modelClass), $success));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(__('The %1$s has been %2$s', true), Inflector::humanize($this->modelClass), $success), $this->redirect);
+ $this->controller->flash(sprintf(__('The %1$s has been %2$s', true), Inflector::humanize($this->modelClass), $success), $this->redirect);
+ return $this->_output();
}
} else {
return $this->controller->_afterScaffoldSaveError($action);
@@ -336,23 +337,25 @@ function __scaffoldDelete($params = array()) {
$this->controller->Session->setFlash(sprintf(__("No id set for %s::delete()", true), Inflector::humanize($this->modelKey)));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(__("No id set for %s::delete()", true), Inflector::humanize($this->modelKey)),
- '/' . Inflector::underscore($this->controller->viewPath));
+ $this->controller->flash(sprintf(__("No id set for %s::delete()", true), Inflector::humanize($this->modelKey)), '/' . Inflector::underscore($this->controller->viewPath));
+ return $this->_output();
}
if ($this->ScaffoldModel->del($id)) {
if (isset($this->controller->Session) && $this->controller->Session->valid() != false) {
$this->controller->Session->setFlash(sprintf(__('The %1$s with id: %2$d has been deleted.', true), Inflector::humanize($this->modelClass), $id));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(__('The %1$s with id: %2$d has been deleted.', true), Inflector::humanize($this->modelClass), $id), '/' . $this->viewPath);
+ $this->controller->flash(sprintf(__('The %1$s with id: %2$d has been deleted.', true), Inflector::humanize($this->modelClass), $id), '/' . $this->viewPath);
+ return $this->_output();
}
} else {
if (isset($this->controller->Session) && $this->controller->Session->valid() != false) {
$this->controller->Session->setFlash(sprintf(__('There was an error deleting the %1$s with id: %2$d', true), Inflector::humanize($this->modelClass), $id));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(__('There was an error deleting the %1$s with id: %2$d', true), Inflector::humanize($this->modelClass), $id), '/' . $this->viewPath);
+ $this->controller->flash(sprintf(__('There was an error deleting the %1$s with id: %2$d', true), Inflector::humanize($this->modelClass), $id), '/' . $this->viewPath);
+ return $this->_output();
}
}
} elseif ($this->controller->_scaffoldError('delete') === false) {

0 comments on commit c0ba43c

Please sign in to comment.
Something went wrong with that request. Please try again.