Skip to content

Commit

Permalink
Replacing cakeError with exceptions in Scaffold.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 28, 2010
1 parent e600f86 commit c4cb629
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions cake/libs/controller/scaffold.php
Expand Up @@ -169,9 +169,7 @@ function __construct(&$controller, $params) {
$this->modelKey = $controller->modelKey;

if (!is_object($this->controller->{$this->modelClass})) {
return $this->cakeError('missingModel', array(array(
'className' => $this->modelClass, 'webroot' => '', 'base' => $controller->base
)));
throw new MissingModelException($this->modelClass);
}

$this->ScaffoldModel =& $this->controller->{$this->modelClass};
Expand Down Expand Up @@ -485,17 +483,11 @@ function __scaffold($params) {
break;
}
} else {
return $this->cakeError('missingAction', array(array(
'className' => $this->controller->name . "Controller",
'base' => $this->controller->base,
'action' => $this->action,
'webroot' => $this->controller->webroot
)));
$message = sprintf('%s::%s()', $this->controller->name . "Controller", $this->action);
throw new MissingActionException($message);
}
} else {
return $this->cakeError('missingDatabase', array(array(
'webroot' => $this->controller->webroot
)));
throw new MissingDatabaseException($this->ScaffoldModel->useDbConfig);
}
}

Expand Down Expand Up @@ -605,6 +597,6 @@ protected function _getViewFileName($name = null) {
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);
}
}

0 comments on commit c4cb629

Please sign in to comment.