Skip to content

Instantly share code, notes, and snippets.

@nomaanp
Created February 12, 2014 04:14
Show Gist options
  • Save nomaanp/8949971 to your computer and use it in GitHub Desktop.
Save nomaanp/8949971 to your computer and use it in GitHub Desktop.
$inputFilter->add($factory->createInput(array(
'name' => 'username',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 3,
'max' => 100,
),
),
array(
'name' => 'Db\NoRecordExists',
'options' => array(
'field' => 'name',
'table' => 'table',
'adapter' => $this->dbAdapter,
'message' => 'record exists',
'exclude' => array(
'field' => 'id',
'value' => $id
)
),
)
),
)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment