DirectorObjectForm: be careful when continuing...

...after an exception
This commit is contained in:
Thomas Gelf 2016-12-14 20:59:26 +01:00
parent cbb3c7aa88
commit a30f34a026

View File

@ -131,13 +131,15 @@ abstract class DirectorObjectForm extends QuickForm
if ($el = $this->getElement($key)) {
if (array_key_exists($key, $post)) {
$this->populate(array($key => $post[$key]));
$old = null;
try {
$old = $object->get($key);
$object->set($key, $el->getValue());
$object->resolveUnresolvedRelatedProperties();
} catch (Exception $e) {
if ($old !== null) {
$object->set($key, $old);
}
$this->addException($e, $key);
}
}