Created
June 15, 2012 07:24
-
-
Save pschichtel/2935194 to your computer and use it in GitHub Desktop.
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 TestController implements Controller | |
{ | |
/** | |
* @validate id numeric | |
* @validate message maxlen(300) | |
* @method post | |
* @ajax false | |
*/ | |
public function messageAction($id, $message) | |
{ | |
// will only be called when both $id and $message are available and have passed the validation | |
} | |
} | |
interface Validator | |
{ | |
public function validate($value, array $args); | |
} | |
public NumericValidator implements Validator | |
{ | |
public function validate($value, array $args) | |
{ | |
return is_numeric($value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment