Created
April 10, 2012 13:12
-
-
Save uppfinnarjohnny/2351256 to your computer and use it in GitHub Desktop.
Validation rules for Kohana 3.2 (kinda)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RegistrationForm extends Validation { | |
public function __construct(Array $array) { | |
parent::__construct($array); | |
$this->rule('username', 'not_empty'); | |
$this->rule('password', 'not_empty'); | |
$this->rule('password_confirmation', 'matches', array(':validation', 'confirm', 'password')); | |
} | |
public function check() { | |
$this['username'] = trim($this['username']); | |
return parent::__check(); | |
} | |
public function offsetSet($offset, $value) { | |
$this->_data[$offset] = $value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment