Deregister removed documents.

@param RemoveEvent $event
361
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        $this->documentRegistry->deregisterDocument($document);
    }
197200
public function onDelete(GenericDataEvent $event)
    {
        /** @var Group[] $groups */
        $groups = $event->getData();

        $ids = [];
        foreach ($groups as $group) {
            $ids[] = $group->getId();
        }

        $this->manager->removeTaggedObjectsByClassAndIds(Group::class, $ids);
    }
1299289
public static function remove(\core\event\base $event) {
        global $DB;

        $DB->delete_records(self::$table, array('cmid' => $event->contextinstanceid));
    }
244543
protected function detachPlugins($event)
    {
        if (\is_array($event->component->plugins_backend)) {
            foreach ($event->component->plugins_backend as $key_plugin => $value_plugin) {
                //Detach SEO plugin
                if ($key_plugin === 'seo' && $seo = LarrockAdminSeo::getModel()->whereSeoIdConnect($event->model->id)
                        ->whereSeoTypeConnect($event->component->name)->first()) {
                    $seo->delete();
                }
            }
        }
    }
700257
public function onPreDelete(StorageEvent $event)
    {
        $entity = $event->getContent();
        if (!$entity instanceof Entity\Content) {
            return;
        }
        $taxonomies = $entity->getTaxonomy();
        if ($taxonomies instanceof Collection\Taxonomy) {
            $repo = $this->em->getRepository(Entity\Taxonomy::class);
            foreach ($taxonomies as $taxonomy) {
                $repo->delete($taxonomy);
            }
        }
        $relations = $entity->getRelation();
        if ($relations instanceof Collection\Relations) {
            $repo = $this->em->getRepository(Entity\Relations::class);
            foreach ($relations as $relation) {
                $repo->delete($relation);
            }
        }
    }
442558
public function onDelete(DeleteResourceEvent $event)
    {
        $em = $this->container->get('claroline.persistence.object_manager');
        $resource = $event->getResource();

        foreach ($resource->getDrops() as $drop) {
            $em->remove($drop);
        }

        $em->remove($event->getResource());
        $event->stopPropagation();
    }
137006
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof PageBehavior) {
            return;
        }

        $page = 1;
        foreach ($document->getParent()->getChildren() as $child) {
            if (!$child instanceof PageBehavior || $child->getUuid() === $document->getUuid()) {
                continue;
            }

            $childNode = $this->documentInspector->getNode($child);
            $childNode->setProperty($this->propertyEncoder->systemName(static::FIELD), ++$page);
        }
    }
566361
public function preDelete(DeleteEvent $event)
    {
        $announcement = $event->getObject();
        $send = $this->om->getRepository(AnnouncementSend::class)->findBy(['announcement' => $announcement]);

        foreach ($send as $el) {
            $this->om->remove($el);
        }

        // delete scheduled task is any
        $this->manager->unscheduleMessage($announcement);

        $this->eventDispatcher->dispatch(
            'log',
            'Claroline\\AnnouncementBundle\\Event\\Log\\LogAnnouncementDeleteEvent',
            [$announcement->getAggregate(), $announcement]
        );
    }
649324
public function detach($event, $callback)
    {
        if (null !== $callback) {
            $oid = $this->hashCallable($callback);
            if (isset($this->callable_map[$event][$oid])) {
                $callback = $this->callable_map[$event][$oid];
                unset($this->callable_map[$event][$oid]);
            }
        } else {
            unset($this->callable_map[$event]);
        }
        return parent::detach($event, $callback);
    }
1297151
public function onDelete(Delete $event)
    {
        if ($this->isDependent()) {
            $class = $this->getRelatedEntity();
            /** @var Entity $entity */
            $entity = new $class();
            $fkField = $this->getForeignKey();
            $pmk = $event->getTarget()->getPrimaryKey();
            $sql = Sql::createSql($entity->getAdapter())
                ->delete($entity->getTableName())
                ->where(
                    ["{$fkField} = :id" => [':id' => $event->getTarget()->$pmk]]
                );

            $sql->execute();
        }
    }
365320
public function unregisterEvent($event , $callback)
    {
        $eventManager = $this->getServiceLocator()->get(EventManager::CONFIG_ID);
        $eventManager->detach($event , $callback);
        $this->getServiceManager()->register(EventManager::CONFIG_ID, $eventManager);
    }
698749
public function handlePostRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        $oid = spl_object_hash($document);
        $event = $this->deleteEvents[$oid];

        $this->eventDispatcher->dispatch(
            ContentEvents::NODE_POST_DELETE,
            $event
        );

        unset($this->deleteEvents[$oid]);
    }
846782
public function onDeleteRelation($event)
    {
        $sender = $event->sender;
        /* @var $sender static */
        if ($sender->relationType == static::$relationMutual) {
            $sender->off(static::EVENT_AFTER_DELETE, [$sender, 'onDeleteRelation']);
            static::removeAllRelations($sender->recipient, $sender->initiator);
            $sender->on(static::EVENT_AFTER_DELETE, [$sender, 'onDeleteRelation']);
        }
    }
1040044
protected function propagateCollectionChangedEvent(CollectionChangedEvent $event)
    {
        if ($event->getType() === CollectionChangedEvent::ITEM_REMOVED) {
            $event->getItem()->removeEntityChangedListener($this);
        } else {
            $event->getItem()->addEntityChangedListener($this);
        }

        parent::propagateCollectionChangedEvent($event);
    }
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();
    }
544443
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();

        if (!$document instanceof RouteBehavior) {
            return;
        }

        $this->recursivelyRemoveRoutes($document);
    }
793454
public static function clear(string $event = '') {
		if (empty($event)) {
			self::$events = [];
		} else {
			self::$events[$event] = [];
		}
	}