diff --git a/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php b/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php index 82e9da6f01..2e46422fc8 100644 --- a/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php +++ b/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php @@ -150,6 +150,10 @@ public function preBindRequest(Request $request) } preg_match('#^delete_pagepartadmin_(\d+)_(.*)#', $key, $ppInfo); + // Skip not persisted sub entities + if (!isset($ppInfo[1], $ppInfo[2])) { + continue; + } preg_match_all('#([a-zA-Z0-9]+)_(\\d+)#', $ppInfo[2], $matches, PREG_SET_ORDER); if (count($matches) > 0) { @@ -172,7 +176,11 @@ public function preBindRequest(Request $request) // Remove sub-entities from pageparts if (\array_key_exists($pagePartRef->getId(), $subPagePartsToDelete)) { $pagePart = $this->pageParts[$pagePartRef->getId()]; + /** @var PagePartDeleteInfo|null $deleteInfo */ foreach ($subPagePartsToDelete[$pagePartRef->getId()] as $deleteInfo) { + if ($deleteInfo === null) { + continue; + } /** @var EntityInterface $deleteObject */ $deleteObject = $this->getObjectForDeletion($pagePart, $deleteInfo);