updating scaffold edit

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6053 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-11-22 18:04:46 +00:00
parent 681c449f35
commit fc10ee7921

View file

@ -259,15 +259,19 @@ class Scaffold extends Object {
}
if ($this->controller->_beforeScaffold($action)) {
if ($action == 'edit' && (!isset($params['pass'][0]) || !$this->ScaffoldModel->exists())) {
if (isset($this->controller->Session) && $this->controller->Session->valid != false) {
$this->controller->Session->setFlash(sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey)));
$this->controller->redirect($this->redirect);
} else {
return $this->controller->flash(sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey)), $this->redirect);
if ($action == 'edit') {
if(isset($params['pass'][0])) {
$this->ScaffoldModel->id = $params['pass'][0];
}
if(!$this->ScaffoldModel->exists()) {
if (isset($this->controller->Session) && $this->controller->Session->valid != false) {
$this->controller->Session->setFlash(sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey)));
$this->controller->redirect($this->redirect);
} else {
return $this->controller->flash(sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey)), $this->redirect);
}
}
} elseif ($action == 'edit') {
$this->ScaffoldModel->id = $params['pass'][0];
}
if (!empty($this->controller->data)) {