/** * Disables validation. * * @return self */ public function disableValidation() { foreach ($this->fields->all() as $field) { if ($field instanceof Field\ChoiceFormField) { $field->disableValidation(); } } return $this; }
/** * Removes a field from the form. * * @param string $name The field name */ public function offsetUnset($name) { $this->fields->remove($name); }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Unreachable field "0" */ public function testFormRegistrySetArrayOnNotCompoundField() { $registry = new FormFieldRegistry(); $registry->add($this->getFormFieldMock('bar')); $registry->set('bar', array('baz')); }
public function testFormRegistrySetValues() { $registry = new FormFieldRegistry(); $registry->add($f2 = $this->getFormFieldMock('foo[2]')); $registry->add($f3 = $this->getFormFieldMock('foo[3]')); $registry->add($fbb = $this->getFormFieldMock('foo[bar][baz]')); $f2->expects($this->exactly(2))->method('setValue')->with(2); $f3->expects($this->exactly(2))->method('setValue')->with(3); $fbb->expects($this->exactly(2))->method('setValue')->with('fbb'); $registry->set('foo[2]', 2); $registry->set('foo[3]', 3); $registry->set('foo[bar][baz]', 'fbb'); $registry->set('foo', array(2 => 2, 3 => 3, 'bar' => array('baz' => 'fbb'))); }