Alex
Alex

Reputation: 1644

CakePHP - Could not find validation handler 1

Based on following line from CakePHP:

trigger_error(__d('cake_dev', 'Could not find validation handler %s for %s', $this->_rule, $field), E_USER_WARNING);

And rules for the field:

'number' => array(
            'required' => true,
            'isUnique' => array('rule' => 'isUnique', 'on' => 'create'),
            'notBlank' => array('rule' => 'notBlank'),
            'maxLength' => array('rule' => array('maxLength', 15)))

CakePHP detects required => true as a rule! When I remove that line, everything works fine!

Note: the field already exists into the data:

$data = array(
    'name' => 'xxx',
    'fields' => 'xxx',
    'startYear' => '999',
    'biography' => 'xxx',
    'headquarter' => 'xxx',
    'number' => '(999) 9999-9999',
    'tags' => 'xxx',
    'updateTime' => '9999999999'
)

How can I fix that problem?

Upvotes: 0

Views: 343

Answers (1)

Alex
Alex

Reputation: 1644

jeremyharris on this discuss helped me. On CakePHP 2.x the required attribute must be used with a rule; But outside of a rule it will be determined as a separated rule.

Upvotes: 1

Related Questions