开发者

I am having problem's with adding a filter in Kohana 3.1

开发者 https://www.devze.com 2023-03-19 01:05 出处:网络
I am having some problems adding a callback filter in Kohana 3.1. Here is my validator: Validation::fa开发者_如何学Pythonctory($fields)

I am having some problems adding a callback filter in Kohana 3.1.

Here is my validator:

Validation::fa开发者_如何学Pythonctory($fields)
                    ->rules('username', $this->_rules['username'])
                    ->rule('username', 'username_available', array($this, ':field'))
                    ->rules('email', $this->_rules['email'])
                    ->rule('email', 'email_available', array($this, ':field'))
                    ->rules('password', $this->_rules['password'])
                    ->rules('password_confirm', $this->_rules['password_confirm'])
                    ->filter('password', $this->_filters['password']);

Here is the array for the filter:

protected $_filters = array(
            'password' => array(
                    'Auth::instance' => 'hash'
            )
    );

It used to look like this:

 public function filters()
 {
   return array(
           'password' => array(
                   array(array(Auth::instance(), 'hash'))
           )
   );
 }

Thanks in advance for any help!


Validation in Kohana 3.1+ doesn't support filters, it's ORM-only feature.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号