Permalink
Browse files

Adding cakeError calls to ModelBehavior.

  • Loading branch information...
1 parent c2db059 commit 7ca1ef22f0d349670f707bc764ae77dedf1420b9 @markstory markstory committed Aug 27, 2009
Showing with 15 additions and 0 deletions.
  1. +15 −0 cake/libs/model/model_behavior.php
@@ -292,6 +292,21 @@ function attach($behavior, $config = array()) {
$class = $name . 'Behavior';
if (!App::import('Behavior', $behavior)) {
+ $this->cakeError('missingBehaviorFile', array(array(
+ 'behavior' => $behavior,
+ 'file' => Inflector::underscore($behavior) . '.php',
+ 'code' => 500,
+ 'base' => '/'
+ )));
+ return false;
+ }
+ if (!class_exists($behavior . 'Behavior')) {
+ $this->cakeError('missingBehaviorClass', array(array(
+ 'behavior' => $behavior,
+ 'file' => Inflector::underscore($behavior) . '.php',
+ 'code' => 500,
+ 'base' => '/'
+ )));
return false;
}

0 comments on commit 7ca1ef2

Please sign in to comment.