| @@ 1179-1221 (lines=43) @@ | ||
| 1176 | * @param string $locale The locale that was used |
|
| 1177 | * @param ArrayCollection $children The children array |
|
| 1178 | */ |
|
| 1179 | private function deleteNodeChildren( |
|
| 1180 | EntityManager $em, |
|
| 1181 | BaseUser $user, |
|
| 1182 | $locale, |
|
| 1183 | ArrayCollection $children |
|
| 1184 | ) { |
|
| 1185 | /* @var Node $childNode */ |
|
| 1186 | foreach ($children as $childNode) { |
|
| 1187 | $childNodeTranslation = $childNode->getNodeTranslation( |
|
| 1188 | $this->locale, |
|
| 1189 | true |
|
| 1190 | ); |
|
| 1191 | ||
| 1192 | $childNodeVersion = $childNodeTranslation->getPublicNodeVersion(); |
|
| 1193 | $childNodePage = $childNodeVersion->getRef($this->em); |
|
| 1194 | ||
| 1195 | $this->dispatch( |
|
| 1196 | new NodeEvent( |
|
| 1197 | $childNode, |
|
| 1198 | $childNodeTranslation, |
|
| 1199 | $childNodeVersion, |
|
| 1200 | $childNodePage |
|
| 1201 | ), |
|
| 1202 | Events::PRE_DELETE |
|
| 1203 | ); |
|
| 1204 | ||
| 1205 | $childNode->setDeleted(true); |
|
| 1206 | $this->em->persist($childNode); |
|
| 1207 | ||
| 1208 | $children2 = $childNode->getChildren(); |
|
| 1209 | $this->deleteNodeChildren($em, $user, $locale, $children2); |
|
| 1210 | ||
| 1211 | $this->dispatch( |
|
| 1212 | new NodeEvent( |
|
| 1213 | $childNode, |
|
| 1214 | $childNodeTranslation, |
|
| 1215 | $childNodeVersion, |
|
| 1216 | $childNodePage |
|
| 1217 | ), |
|
| 1218 | Events::POST_DELETE |
|
| 1219 | ); |
|
| 1220 | } |
|
| 1221 | } |
|
| 1222 | ||
| 1223 | /** |
|
| 1224 | * @param Request $request |
|
| @@ 449-484 (lines=36) @@ | ||
| 446 | * @param Node $node |
|
| 447 | * @param string $locale |
|
| 448 | */ |
|
| 449 | protected function deleteNodeChildren(Node $node, $locale) |
|
| 450 | { |
|
| 451 | $children = $node->getChildren(); |
|
| 452 | ||
| 453 | /* @var Node $childNode */ |
|
| 454 | foreach ($children as $childNode) { |
|
| 455 | $childNodeTranslation = $childNode->getNodeTranslation($locale, true); |
|
| 456 | $childNodeVersion = $childNodeTranslation->getPublicNodeVersion(); |
|
| 457 | $childNodePage = $childNodeVersion->getRef($this->em); |
|
| 458 | ||
| 459 | $this->dispatch( |
|
| 460 | new NodeEvent( |
|
| 461 | $childNode, |
|
| 462 | $childNodeTranslation, |
|
| 463 | $childNodeVersion, |
|
| 464 | $childNodePage |
|
| 465 | ), |
|
| 466 | Events::PRE_DELETE |
|
| 467 | ); |
|
| 468 | ||
| 469 | $childNode->setDeleted(true); |
|
| 470 | $this->em->persist($childNode); |
|
| 471 | ||
| 472 | $this->deleteNodeChildren($childNode, $locale); |
|
| 473 | ||
| 474 | $this->dispatch( |
|
| 475 | new NodeEvent( |
|
| 476 | $childNode, |
|
| 477 | $childNodeTranslation, |
|
| 478 | $childNodeVersion, |
|
| 479 | $childNodePage |
|
| 480 | ), |
|
| 481 | Events::POST_DELETE |
|
| 482 | ); |
|
| 483 | } |
|
| 484 | } |
|
| 485 | ||
| 486 | /** |
|
| 487 | * @return mixed|null |
|