本文整理匯總了PHP中Zend\InputFilter\Input::setName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Input::setName方法的具體用法?PHP Input::setName怎麽用?PHP Input::setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\InputFilter\Input
的用法示例。
在下文中一共展示了Input::setName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInputFilter
public function getInputFilter()
{
if (!$this->inputFilter) {
$input = new Input();
$input->setName('entities');
$input->setRequired(false);
$this->inputFilter = new RealInputFilter();
$this->inputFilter->add($input);
}
return $this->inputFilter;
}
示例2: getInputFilter
public function getInputFilter()
{
$inputFilter = new InputFilter();
$username = new Input();
$username->setName('username')->setRequired(true);
$username->setErrorMessage('A Username is required to Login');
$inputFilter->add($username);
$password = new Input();
$password->setName('password')->setRequired(true);
$password->setErrorMessage('A Password is required to Login');
$inputFilter->add($password);
return $inputFilter;
}
示例3: createService
/**
* @param ServiceLocatorInterface $serviceLocator
*
* @return InputFilter
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$username = new Input();
$username->setName('username');
$username->setRequired(true);
$username->setAllowEmpty(false);
$username->getFilterChain()->attach(new StringTrim())->attach(new StripTags());
$password = new Input();
$password->setName('password');
$password->setRequired(true);
$password->setAllowEmpty(false);
$password->getFilterChain()->attach(new StringTrim())->attach(new StripTags());
$password->getValidatorChain()->attach($serviceLocator->get('UghAuthentication\\Authentication\\Validator\\Authentication'));
$inputFilter = new InputFilter();
$inputFilter->add($username);
$inputFilter->add($password);
return $inputFilter;
}
示例4: setControlName
/**
* Manually override the default control name for this field.
*
* This can be useful and necessary if you are using multiple instances of
* the same model and field on a single page and you need to disambiguate
* them.
*
* @param string $controlName
* @return \Dewdrop\Db\Field
*/
public function setControlName($controlName)
{
$this->controlName = $controlName;
if ($this->inputFilter) {
$this->inputFilter->setName($this->controlName);
}
return $this;
}
示例5: testInputFilterValidates
public function testInputFilterValidates()
{
$baddata = '1234';
$gooddata = '12345';
$tableName = 'sometable';
$service = new AggregateEntityFilterService();
$service->setBaseTable($tableName);
$entityFilter = new BaseEntityFilterService();
$entityFilter->setTableName($tableName);
$input = new Input();
$input->setName('name')->setAllowEmpty(FALSE)->getValidatorChain()->attach(new StringLength(5));
$inputFilter = new InputFilter();
$inputFilter->add($input);
$entityFilter->setInputFilter($inputFilter);
$entityFilter->setData(array('name' => $baddata));
$service->add($entityFilter);
$this->assertFalse($service->isValid(), 'Should have failed filter input validator');
$service = new AggregateEntityFilterService();
$service->setBaseTable($tableName);
$entityFilter->setData(array('name' => $gooddata));
$service->add($entityFilter);
$this->assertTrue($service->isValid(), 'Should have passed filter input validator');
}