Created
July 15, 2012 15:33
-
-
Save awartoft/3117472 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 | |
/** | |
* @author Antoine Hedgecock <[email protected]> | |
*/ | |
/** | |
* @namespace | |
*/ | |
namespace User\Form\Account; | |
use Zend\Form\Form, | |
Zend\InputFilter\InputFilter, | |
Zend\Stdlib\Hydrator\ClassMethods, | |
Zend\ServiceManager\ServiceManager, | |
Zend\ServiceManager\ServiceManagerAwareInterface; | |
class Register extends Form implements ServiceManagerAwareInterface | |
{ | |
public function __construct() | |
{ | |
parent::__construct('user_account_register'); | |
$this->setHydrator(new ClassMethods()) | |
->setInputFilter(new InputFilter()); | |
$this->add( | |
array( | |
'name' => 'user', | |
'type' => 'User\Form\Fieldsets\UserFieldset', | |
'options' => array( | |
'use_as_base_fieldset' => true | |
) | |
) | |
); | |
} | |
public function setServiceManager(ServiceManager $serviceManager) | |
{ | |
$this->get('user') | |
->setHydrator($serviceManager->get('entityHydrator')); | |
$filter = $this->getInputFilter(); | |
// We need to add a few filters | |
$filter->get('user') | |
->add( | |
array( | |
'name' => 'email', | |
'validators' => array( | |
array( | |
'name' => 'callback', | |
'options' => array( | |
'callback' => function($fo) { | |
} | |
) | |
) | |
) | |
) | |
); | |
ob_clean(); | |
var_dump($filter->get('user')->get('email')->getValidatorChain()); | |
exit; | |
} | |
} |
Author
awartoft
commented
Jul 15, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment