Skip to content

Instantly share code, notes, and snippets.

@graste
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save graste/0ff1bac943d90e80704d to your computer and use it in GitHub Desktop.

Select an option

Save graste/0ff1bac943d90e80704d to your computer and use it in GitHub Desktop.
literalized argument name in agavi validator
<?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