2011-07-10 37 views
0

我在添加Kohana 3.1中的回調過濾器時遇到了一些問題。我在添加Kohana 3.1中的過濾器時遇到了問題3.1

這裏是我的驗證:

Validation::factory($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']); 

下面是過濾器的陣列:

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

它曾經是這樣的:

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

預先感謝任何幫幫我!

+0

什麼是問題? – biakaveron

+0

ErrorException [致命錯誤]:調用未定義的方法Validation :: filter() – jnbdz

+0

在這一行上: - > filter('password',$ this - > _ filters ['password']); – jnbdz

回答

1

在Kohana 3.1+中的驗證不支持過濾器,它是ORM專用功能。

+0

Ko3.1中的ORM也沒有過濾器。只有規則。 – biakaveron

+0

@biakaveron:這就是我暗示的原因 – Kemo