rectorObjectForm: catch errors when setting props
This commit is contained in:
parent
d990abf0df
commit
f073b4d6a9
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Icinga\Module\Director\Web\Form;
|
namespace Icinga\Module\Director\Web\Form;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use Icinga\Module\Director\Objects\DirectorDatafield;
|
use Icinga\Module\Director\Objects\DirectorDatafield;
|
||||||
use Zend_Form_Element_Select as Zf_Select;
|
use Zend_Form_Element_Select as Zf_Select;
|
||||||
|
@ -187,7 +188,13 @@ abstract class DirectorObjectForm extends QuickForm
|
||||||
protected function handleProperties($object, & $values)
|
protected function handleProperties($object, & $values)
|
||||||
{
|
{
|
||||||
if ($this->hasBeenSent()) {
|
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();
|
$props = $object->getProperties();
|
||||||
|
|
Loading…
Reference in New Issue