Replacing cakeError with exceptions in Scaffold.

This commit is contained in:
mark_story 2010-08-27 23:54:00 -04:00
parent e600f86abd
commit c4cb629d80

View file

@ -169,9 +169,7 @@ class Scaffold extends Object {
$this->modelKey = $controller->modelKey; $this->modelKey = $controller->modelKey;
if (!is_object($this->controller->{$this->modelClass})) { if (!is_object($this->controller->{$this->modelClass})) {
return $this->cakeError('missingModel', array(array( throw new MissingModelException($this->modelClass);
'className' => $this->modelClass, 'webroot' => '', 'base' => $controller->base
)));
} }
$this->ScaffoldModel =& $this->controller->{$this->modelClass}; $this->ScaffoldModel =& $this->controller->{$this->modelClass};
@ -485,17 +483,11 @@ class Scaffold extends Object {
break; break;
} }
} else { } else {
return $this->cakeError('missingAction', array(array( $message = sprintf('%s::%s()', $this->controller->name . "Controller", $this->action);
'className' => $this->controller->name . "Controller", throw new MissingActionException($message);
'base' => $this->controller->base,
'action' => $this->action,
'webroot' => $this->controller->webroot
)));
} }
} else { } else {
return $this->cakeError('missingDatabase', array(array( throw new MissingDatabaseException($this->ScaffoldModel->useDbConfig);
'webroot' => $this->controller->webroot
)));
} }
} }
@ -605,6 +597,6 @@ class ScaffoldView extends ThemeView {
return LIBS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp'; return LIBS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
} }
return $this->_missingView($paths[0] . $name . $this->ext, 'missingView'); throw new MissingViewException($paths[0] . $name . $this->ext);
} }
} }