Permalink
Browse files

fix PR suggestions

  • Loading branch information...
1 parent 198b1e0 commit 3c46cdd04f110c6987807ed337c9d105c32c1d66 @marcopeg marcopeg committed Nov 2, 2012
@@ -282,7 +282,7 @@ public function process($field, &$data, &$methods) {
$location = $plugin . '.' . $location;
}
App::uses($className, $location);
- if (class_exists($className) && method_exists($className, $method)) {
+ if ( is_callable(array($className,$method)) ) {
$this->_valid = call_user_func_array(array($className, $method), $this->_ruleParams);
} else {
trigger_error(__d('cake_dev', 'Could not find custom validation rule %s', $this->_rule), E_USER_WARNING);
@@ -11,10 +11,10 @@ class CustomValidationObjectController extends AppController {
public $autoRender = false;
- public $uses = array( 'CustomValidationModel' );
+ public $uses = array('CustomValidationModel');
public function index() {
- $data = array( 'CustomValidationModel' => array(
+ $data = array('CustomValidationModel' => array(
'name' => '',
'surname' => '',
'age' => '',
@@ -25,4 +25,4 @@ public function index() {
debug($this->CustomValidationModel->validationErrors);
}
-}
+}
@@ -15,8 +15,8 @@ class CustomValidationModel extends AppModel {
public $useTable = false;
public $validate = array(
- 'name' => 'notEmpty',
- 'surname' => array(
+ 'name' => 'notEmpty',
+ 'surname' => array(
'rule' => 'CustomValidationObject::myCustomRule',
'message' => 'value not accepted'
),
@@ -27,4 +27,4 @@ class CustomValidationModel extends AppModel {
)
);
-}
+}
@@ -9,4 +9,4 @@ public static function myCustomRule($value) {
return self::odd(rand(2,10));
}
-}
+}

0 comments on commit 3c46cdd

Please sign in to comment.