Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

… not using Sessions. Refs #64
  • Loading branch information...
commit 84b230413a7e46d94a6b899b06e68945c52cc20c 1 parent 9c82d19
@markstory markstory authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 cake/libs/controller/scaffold.php
View
15 cake/libs/controller/scaffold.php
@@ -334,10 +334,8 @@ function __scaffoldSave($params = array(), $action = 'edit') {
));
$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);
@@ -393,9 +391,10 @@ function __scaffoldDelete($params = array()) {
));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(
+ $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->delete($id)) {
@@ -406,10 +405,11 @@ function __scaffoldDelete($params = array()) {
));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(
+ $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 ($this->_validSession) {
@@ -419,10 +419,11 @@ function __scaffoldDelete($params = array()) {
));
$this->controller->redirect($this->redirect);
} else {
- return $this->controller->flash(sprintf(
+ $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) {
Please sign in to comment.
Something went wrong with that request. Please try again.