From ac3e5d26695a7f466316d49162cd8fd187e26ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 6 Oct 2019 15:49:42 +0200 Subject: [PATCH] Fixed exception when try to create a new part. --- .../EntityListeners/ElementPermissionListener.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Security/EntityListeners/ElementPermissionListener.php b/src/Security/EntityListeners/ElementPermissionListener.php index 9a1e7059..248909b7 100644 --- a/src/Security/EntityListeners/ElementPermissionListener.php +++ b/src/Security/EntityListeners/ElementPermissionListener.php @@ -134,10 +134,12 @@ class ElementPermissionListener //If the user is not allowed to edit or read this property, reset all values. if ((!$this->security->isGranted($annotation->getEditOperationName(), $element) - || !$this->security->isGranted($annotation->getReadOperationName(), $element))) { + || !$this->security->isGranted($annotation->getReadOperationName(), $element))) { //Set value to old value, so that there a no change to this property - $property->setValue($element, $old_data[$property->getName()]); - $changed = true; + if (isset($old_data[$property->getName()])) { + $property->setValue($element, $old_data[$property->getName()]); + $changed = true; + } }