Skip to content
Permalink
Browse files

Adding MissingModelException.

  • Loading branch information...
markstory committed Aug 28, 2010
1 parent caf7668 commit b301b0d86e87f190a3cf4638de2024b67fb4a6ed
Showing with 4 additions and 3 deletions.
  1. +4 −3 cake/libs/controller/controller.php
@@ -572,6 +572,7 @@ public function httpCodes($code = null) {
* @param string $modelClass Name of model class to load
* @param mixed $id Initial ID the instanced model class should have
* @return mixed true when single model found and instance created, error returned if model not found.
* @throws MissingModelException if the model class cannot be found.
*/
public function loadModel($modelClass = null, $id = null) {
if ($modelClass === null) {
@@ -593,9 +594,7 @@ public function loadModel($modelClass = null, $id = null) {
));
if (!$this->{$modelClass}) {
return $this->cakeError('missingModel', array(array(
'className' => $modelClass, 'webroot' => '', 'base' => $this->base
)));
throw new MissingModelException($modelClass);
}
if ($this->persistModel === true) {
@@ -1252,3 +1251,5 @@ public function _scaffoldError($method) {
return false;
}
}
class MissingModelException extends RuntimeException {}

0 comments on commit b301b0d

Please sign in to comment.
You can’t perform that action at this time.