Last active
August 29, 2015 14:04
-
-
Save graste/0ff1bac943d90e80704d to your computer and use it in GitHub Desktop.
literalized argument name in agavi validator
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 YourValidator extends AgaviValidator | |
| { | |
| public function validate() | |
| { | |
| if ($this->hasMultipleArguments()) { | |
| $this->throwError('multiple_arguments'); | |
| return false; | |
| } | |
| // this is done to allow to set a default argument in a validator_definition | |
| $argument_name = $this->getArgument(); | |
| if (false === $argument_name) { | |
| $argument_name = $this->getParameter('argument_name'); | |
| $this->arguments = array($argument_name); | |
| } | |
| ... | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment