public function updateObject($values = null) { $object = parent::updateObject($values); foreach ($this->embeddedForms as $key => $form) { if (!($form->getObject() && $form->getObject()->File != null)) { unset($this->embeddedForms[$key]); } } return $object; }
public function updateObject($values = null) { if (null === $values) { $values = $this->values; } $object = parent::updateObject($values); foreach ($this->embeddedForms as $key => $form) { if (!($form->getObject() && $form->getObject()->File != null) || isset($values[$key]) && empty($values[$key]['photo']) && empty($values[$key]['photo_delete'])) { unset($this->embeddedForms[$key]); } } return $object; }