public function setName($name) { parent::setName($name); foreach ($this->getChildren() as $child) { /** @var FormField $child */ $thisName = $child->getName(); $thisName = preg_replace('/^.*(\\[\\w+\\])$/', $name . '\\1', $thisName); $child->setName($thisName); } }