基于CakePHP的以下行:
trigger_error(__d('cake_dev', 'Could not find validation handler %s for %s', $this->_rule, $field), E_USER_WARNING);
该领域的规则:
'number' => array(
'required' => true,
'isUnique' => array('rule' => 'isUnique', 'on' => 'create'),
'notBlank' => array('rule' => 'notBlank'),
'maxLength' => array('rule' => array('maxLength', 15)))
CakePHP通常会检测required => true
!当我删除该行时,一切正常!
注意:该字段已存在于数据中:
$data = array(
'name' => 'xxx',
'fields' => 'xxx',
'startYear' => '999',
'biography' => 'xxx',
'headquarter' => 'xxx',
'number' => '(999) 9999-9999',
'tags' => 'xxx',
'updateTime' => '9999999999'
)
我该如何解决这个问题?
答案 0 :(得分:1)
jeremyharris对此discuss帮助了我。在CakePHP 2.x上,required
属性必须与规则一起使用;但在规则之外,它将被确定为一个单独的规则。