On sitemap node delete.

@param TreeNodeEvent $event
346976
public function onSitemapNodeDelete(TreeNodeEvent $event)
    {
        $node = $event->getNode();
        if (TextNodeInterface::NODE_TYPE === $node->getType()) {
            $this->nodeHandler->onDeleteNode($node);
        }
    }
901244
public function onDeleteNode(NodeInterface $node)
    {
        $textNode = $this->textNodeManager->findTextNodeByNode($node);

        if (null !== $textNode) {
            $this->textNodeManager->remove($textNode);
            $this->textManager->remove($textNode->getText());
        }
    }
202655
public function remove(EntityRemoved $event)
    {
        $entity = $event->getEntity();
        $collection = $event->getCollection();
        $this->deleteRelation($entity, $collection);
    }
1125209
public function remove($event = null)
    {
        if (!is_null($event)) {
            unset($this->events[$event]);
        }

        $this->events = [];
    }
586343
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $this->indexer->remove($document);
        $this->indexer->flush();
    }
50996
public function onDelete(DeleteResourceEvent $event)
    {
        $this->om->remove($event->getResource());
        $event->stopPropagation();
    }
1324723
public function beforeDelete(Delete $event)
    {
        $parent = $event->getEntity()->{$this->propertyName};
        if ($parent instanceof EntityInterface) {
            $parent->delete();
        }
    }
234920
public function onDelete(DeleteResourceEvent $event)
    {
        /** @var File $file */
        $file = $event->getResource();

        $pathName = $this->filesDir.DIRECTORY_SEPARATOR.$file->getHashName();

        if (file_exists($pathName)) {
            $event->setFiles([$pathName]);
        }

        $event->stopPropagation();
    }
583451
public function onVisitNode(VisitNodeEvent $event)
    {
        $node = $event->getNode();
        if ($node instanceof AbstractScalarOperatorNode &&
            $this->isExtrefField($node->getField(), $event->getContext())) {
            $event->setNode($this->processScalarNode($node));
        } elseif ($node instanceof AbstractArrayOperatorNode &&
            $this->isExtrefField($node->getField(), $event->getContext())) {
            $event->setNode($this->processArrayNode($node));
        }

        return $event;
    }
300604
public function onPreDelete(ResourceEventInterface $event)
    {
        $page = $this->getPageFromEvent($event);

        if ($page->isStatic()) {
            $event->addMessage(new ResourceMessage(
                'ekyna_cms.page.alert.do_not_remove_static',
                ResourceMessage::TYPE_ERROR
            ));
        }
    }
1360413
public function deleteDoctrineCache(SiteEvent $event)
    {
        if ($cacheImpl = $this->em->getConfiguration()->getResultCacheImpl()) {
            $cacheImpl->delete(SiteInterface::SITE);
        }
    }
570203
public function onPostDelete(ResourceEventInterface $event)
    {
        $page = $this->getPageFromEvent($event);

        $this->deletePageCache($page);
    }
217337
protected function applyEventDeleted(EventDeleted $event)
    {
        $eventId = $event->getItemId();
        $this->repository->removeRelations($eventId);

    }
1286271
public static function onRemoveElementFile(Event $event)
    {
        $dispatcher = $event->getDispatcher();
        $application = $dispatcher->getApplication();

        try {
            $content = $event->getEventArgs()->getEntity();
            if (!($content instanceof ElementFile)) {
                return;
            }

            $includePath = array($application->getStorageDir(), $application->getMediaDir());
            if (null !== $application->getBBUserToken()) {
                $includePath[] = $application->getTemporaryDir();
            }

            $filename = $content->path;
            File::resolveFilepath($filename, null, array('include_path' => $includePath));

            @unlink($filename);
        } catch (\Exception $e) {
            $application->warning('Unable to delete file: '.$e->getMessage());
        }
    }
1237203
private function deleteChildren( $node ) {
		while ( isset( $node->firstChild ) ) {
			$this->deleteChildren( $node->firstChild );
			$node->removeChild( $node->firstChild );
		}
	}
756201
public function onSiteClone(SiteCloneEvent $event)
    {
        $source = $event->getTemplateSite();
        $target = $event->getSite();

        $this->ensureSiteMenus($source);
        $this->ensureSiteMenus($target);

        if ($this->treeManager && $this->allowedMenus) {
            foreach (array_keys($this->allowedMenus) as $prefix) {

                $sourceName = $prefix . '-' . $source->getId();
                $targetName = $prefix . '-' . $target->getId();

                $this->treeManager->cloneMenuIn($sourceName, $targetName);
            }
        }
    }
1004170
private function deleteNode( $node ) {
		$this->deleteChildren( $node );
		$parent = $node->parentNode;
		$oldnode = $parent->removeChild( $node );
	}