From f073b4d6a9719beefcbf4887d503fe90a7abe5ea Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 5 Mar 2016 15:58:24 +0100 Subject: [PATCH] rectorObjectForm: catch errors when setting props --- library/Director/Web/Form/DirectorObjectForm.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php index e004d48f..f0d14210 100644 --- a/library/Director/Web/Form/DirectorObjectForm.php +++ b/library/Director/Web/Form/DirectorObjectForm.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Director\Web\Form; +use Exception; use Icinga\Module\Director\Objects\IcingaObject; use Icinga\Module\Director\Objects\DirectorDatafield; use Zend_Form_Element_Select as Zf_Select; @@ -187,7 +188,13 @@ abstract class DirectorObjectForm extends QuickForm protected function handleProperties($object, & $values) { if ($this->hasBeenSent()) { - $object->setProperties($values); + foreach ($values as $key => $value) { + try { + $object->set($key, $value); + } catch (Exception $e) { + $this->getElement($key)->addError($e->getMessage()); + } + } } $props = $object->getProperties();