Skip to content

Instantly share code, notes, and snippets.

@alexshelkov
Created October 29, 2012 17:45
Show Gist options
  • Save alexshelkov/3975150 to your computer and use it in GitHub Desktop.
Save alexshelkov/3975150 to your computer and use it in GitHub Desktop.
<?php
namespace Application\Form\Fieldset;
use Zend\Form\Fieldset as ZendFieldset;
use Application\Model\User as ModelUser;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
use Zend\InputFilter\InputFilterProviderInterface;
class User extends ZendFieldset implements InputFilterProviderInterface
{
public function __construct($name = null, $options = array())
{
parent::__construct('user');
$this->setHydrator(new ClassMethodsHydrator());
$this->setObject(new ModelUser());
$this->add(array(
'name' => 'name',
'options' => array(
'label' => 'User name',
),
'attributes' => array(
'type' => 'text',
),
));
}
// I want add some basic filters here too
public function getInputFilterSpecification()
{
return array(
'name' => array(
'filters' => array(
array('name' => 'Zend\Filter\StringTrim'),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment