【发布时间】:2010-12-15 12:35:05
【问题描述】:
注意:此问题仅针对 Kohana 3.0。 Kohana 3.1 和更新版本以完全不同的方式处理验证回调。
我正在使用回调 (ORM) 进行验证。这些是我的代码:
class Model_Loja extends ORM {
// more code goes here!
protected $_callbacks = array(
'endereco' => array('endereco_unico')
);
public function endereco_unico(Validate $validate, $campo) {
$resultado = $this->where('endereco', '=', $this->endereco)->find_all();
if(count($resultado)) {
return false;
}
else {
return true;
}
}
// more code goes here!
它返回 true 或 false(如果有值,则返回 false)但是当它返回 false 时我如何发送验证消息?
【问题讨论】:
标签: validation callback kohana-3 kohana-orm kohana-3.0