Skip to content

Commit

Permalink
Merge pull request #3453 from insiders/subenetities-persist-check
Browse files Browse the repository at this point in the history
[PagePart] (fix) skip checking for not persisted sub entites delete c…
  • Loading branch information
acrobat authored Nov 1, 2024
2 parents ccdcc42 + 8a60c70 commit 1d953e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Expand Down

0 comments on commit 1d953e6

Please sign in to comment.