Handles delete event for articles. Unlink article from entry and
unpublishes entry.

@param  Newscoop\EventDispatcher\Events\GenericEvent $event
760585
public function delete(GenericEvent $event)
    {
        $eventCaller = $event->getSubject();
        $arguments = $event->getArguments();

        if ($eventCaller instanceof \Article) {
            $entry = $this->em
                ->getRepository('Newscoop\IngestPluginBundle\Entity\Feed\Entry')
                ->findOneByArticleId($eventCaller->getArticleNumber());
            if ($entry !== null) {
                $entry->setArticleId(NULL);
                $entry->setPublished(NULL);
                $this->em->persist($entry);
                $this->em->flush();
            }
        }
    }
586343
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $this->indexer->remove($document);
        $this->indexer->flush();
    }
993420
public function detach($event, $callback){
        $events = is_array($event) ? $event : array($event);
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        foreach ($events as $event) {
            $eventObject = is_object($event) ? $event : new GenericEvent($event);
            $listeners = $this->removeListener($listeners, $eventObject, $callback);
        }
        $this->setOption(self::OPTION_LISTENERS, $listeners);
    }
355636
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        $node = $this->documentRegistry->getNodeForDocument($document);

        $node->remove();
    }
1324723
public function beforeDelete(Delete $event)
    {
        $parent = $event->getEntity()->{$this->propertyName};
        if ($parent instanceof EntityInterface) {
            $parent->delete();
        }
    }
1040044
protected function propagateCollectionChangedEvent(CollectionChangedEvent $event)
    {
        if ($event->getType() === CollectionChangedEvent::ITEM_REMOVED) {
            $event->getItem()->removeEntityChangedListener($this);
        } else {
            $event->getItem()->addEntityChangedListener($this);
        }

        parent::propagateCollectionChangedEvent($event);
    }
194313
protected function dispatchEvent(\Erebot\Interfaces\Event\Base\Generic $event)
    {
        $logger = \Plop\Plop::getInstance();
        $logger->debug(
            $this->bot->gettext('Dispatching "%(type)s" event.'),
            array('type' => get_class($event))
        );
        try {
            foreach ($this->events as $handler) {
                if ($handler->handleEvent($event) === false) {
                    break;
                }
            }
        } catch (\Erebot\ErrorReportingException $e) {
            // This should help make the code a little more "bug-free" (TM).
            $logger->exception($this->bot->gettext('Code is not clean!'), $e);
            $this->disconnect($e->getMessage());
        }
    }
886760
public function onObjectTag(GenericDatasEvent $event)
    {
        $taggedObject = null;
        $datas = $event->getDatas();

        if (is_array($datas) && isset($datas['tag']) && isset($datas['object'])) {
            $user = isset($datas['user']) ? $datas['user'] : null;
            $taggedObject = $this->tagManager->tagObject($datas['tag'], $datas['object'], $user);
        }
        $event->setResponse($taggedObject);
    }
731526
public function removeEvent($event, $table = null): void
    {
        unset($this->events[$table ?? static::TABLE_ANY][$event]);
    }
1299289
public static function remove(\core\event\base $event) {
        global $DB;

        $DB->delete_records(self::$table, array('cmid' => $event->contextinstanceid));
    }
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]
        );
    }
1075414
public function delete(FeatureAvDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== ($feature = FeatureAvQuery::create()->findPk($event->getFeatureAvId()))) {
            $feature
                ->setDispatcher($dispatcher)
                ->delete()
            ;

            $event->setFeatureAv($feature);
        }
    }
740403
public function deleteImage(EventInterface $event) {
        $request = $event->getRequest();
        $event->getStorage()->delete($request->getUser(), $request->getImageIdentifier());
    }
361
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        $this->documentRegistry->deregisterDocument($document);
    }
772312
public function onDelete(GenericDataEvent $event)
    {
        /** @var UserEntity[] $users */
        $users = $event->getData();

        $ids = [];
        foreach ($users as $user) {
            $ids[] = $user->getId();
        }

        $this->manager->removeTaggedObjectsByClassAndIds(UserEntity::class, $ids);
    }
998842
public function remove(EventInterface $event)
    {
        $index = $this->computeIndex($event);
        if (isset($this->events[$index])) {
            foreach ($this->events[$index] as $key => $internalEvent) {
                if ($event->getUid() == $internalEvent->getUid()) {
                    unset($this->events[$index][$key]);
                    --$this->count;
                }
            }
        }
    }
821996
public function remove(EventInterface $event)
    {
        foreach ($this->events as $key => $internalEvent) {
            if ($event->getUid() === $internalEvent->getUid()) {
                unset($this->events[$key]);
            }
        }
    }