本文整理汇总了PHP中Zend\Form\Form::setValidationGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::setValidationGroup方法的具体用法?PHP Form::setValidationGroup怎么用?PHP Form::setValidationGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Form
的用法示例。
在下文中一共展示了Form::setValidationGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFormValidationCanHandleNonConsecutiveKeysOfCollectionInData
public function testFormValidationCanHandleNonConsecutiveKeysOfCollectionInData()
{
$dataWithCollection = array('foo' => 'bar', 'categories' => array(0 => array('name' => 'cat1'), 1 => array('name' => 'cat2'), 3 => array('name' => 'cat3')));
$this->populateForm();
$this->form->add(array('type' => 'Zend\\Form\\Element\\Collection', 'name' => 'categories', 'options' => array('count' => 1, 'allow_add' => true, 'target_element' => array('type' => 'ZendTest\\Form\\TestAsset\\CategoryFieldset'))));
$this->form->setValidationGroup(array('foo', 'categories' => array('name')));
$this->form->setData($dataWithCollection);
$this->assertTrue($this->form->isValid());
}
示例2: testApplyObjectInputFilterToBaseFieldsetAndApplyValidationGroup
public function testApplyObjectInputFilterToBaseFieldsetAndApplyValidationGroup()
{
$fieldset = new Fieldset('foobar');
$fieldset->add(new Element('foo'));
$fieldset->setUseAsBaseFieldset(true);
$this->form->add($fieldset);
$this->form->setValidationGroup(array('foobar' => array('foo')));
$inputFilterFactory = new InputFilterFactory();
$inputFilter = $inputFilterFactory->createInputFilter(array('foo' => array('name' => 'foo', 'required' => true)));
$model = new TestAsset\ValidatingModel();
$model->setInputFilter($inputFilter);
$this->form->bind($model);
$this->form->setData(array());
$this->assertFalse($this->form->isValid());
$validSet = array('foobar' => array('foo' => 'abcde'));
$this->form->setData($validSet);
$this->assertTrue($this->form->isValid());
}
示例3: testGetValidationGroup
public function testGetValidationGroup()
{
$group = array('foo');
$this->form->setValidationGroup($group);
$this->assertEquals($group, $this->form->getValidationGroup());
}
示例4: setFormValidationGroup
/**
* (non-PHPdoc)
*
* @see \Zend\Form\Form::setValidationGroup()
*/
public function setFormValidationGroup($validationGroup)
{
parent::setValidationGroup(ArrayUtils::merge($validationGroup, array('csrf')));
}