/** * {@inheritDoc} */ public function bind($data) { if ($this->mode === self::GROUP) { parent::bind($data); } else { Field::bind($data); } }
public function bind($taintedData) { if (is_null($taintedData)) { $taintedData = array(); } foreach ($this as $name => $field) { if (!isset($taintedData[$name]) && $this->getOption('modifiable') && $name != '$$key$$') { $this->remove($name); } } foreach ($taintedData as $name => $value) { if (!isset($this[$name]) && $this->getOption('modifiable')) { $this->add($this->newField($name, $name)); } } return parent::bind($taintedData); }
public function bind($taintedData) { $this->removedFields = array(); if (null === $taintedData) { $taintedData = array(); } foreach ($this as $name => $field) { if (!isset($taintedData[$name]) && $this->getOption('modifiable') && '$$key$$' != $name) { $this->remove($name); $this->removedFields[] = $name; } } foreach ($taintedData as $name => $value) { if (!isset($this[$name]) && $this->getOption('modifiable')) { $this->add($this->newField($name, $name)); } } parent::bind($taintedData); }
/** * Binds the form with the given data. * * @param array $taintedData The data to bind to the form * @return boolean Whether the form is valid */ protected function doBind(array $taintedData) { parent::bind($taintedData); }
public function testBindWithoutPriorSetData() { return; // TODO $field = $this->createMockField('firstName'); $field->expects($this->any())->method('getData')->will($this->returnValue('Bernhard')); $group = new FieldGroup('author'); $group->add($field); $group->bind(array('firstName' => 'Bernhard')); $this->assertEquals(array('firstName' => 'Bernhard'), $group->getData()); }