/** * @param Form $form */ private function setData(Form $form) { if (!$this->entity->isDetached()) { foreach ($form->getComponents() as $control) { $name = $control->getName(); if (isset($this->entity->{$name})) { if ($control instanceof Container) { $control->setDefaults($this->entity->{$name}); } else { $control->setDefaultValue($this->entity->{$name}); } } } } }