本文整理汇总了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');
}