Handles delete event

@param \Grid\User\Datasheet\Event\Delete $event
@return \Grid\User\Datasheet\Event\Delete
195226
public function onDelete(Event\Delete $event)
    {
        $success = $event->getUser()->delete();
        $event->setResult( (bool)$success );
        if( $event->getResult() === false )
        {
            $event->stopPropagation(true);
        }
        return $event;
    }
516946
public function preDelete(DeleteEvent $event)
    {
        /** @var User $user */
        $user = $event->getObject();
        $userRole = $this->roleManager->getUserRole($user->getUsername());

        //soft delete~
        $user->setIsRemoved(true);
        $user->setEmail('email#'.$user->getId());
        $user->setFirstName('firstname#'.$user->getId());
        $user->setLastName('lastname#'.$user->getId());
        $user->setPlainPassword(uniqid());
        $user->setUsername('username#'.$user->getId());
        $user->setPublicUrl('removed#'.$user->getId());
        $user->setAdministrativeCode('code#'.$user->getId());
        $user->setIsEnabled(false);

        // keeping the user's workspace with its original code
        // would prevent creating a user with the same username
        // todo: workspace deletion should be an option
        $ws = $user->getPersonalWorkspace();

        if ($ws) {
            $ws->setCode($ws->getCode().'#deleted_user#'.$user->getId());
            $ws->setDisplayable(false);
            $this->om->persist($ws);
        }

        if ($userRole) {
            $this->om->remove($userRole);
        }
        $this->om->persist($user);
        $this->om->flush();

        //dispatch some events but they should be listening the same as we are imo.
        //something should be done for event listeners
        $this->dispatcher->dispatch('claroline_users_delete', 'GenericData', [[$user]]);
        $this->dispatcher->dispatch('log', 'Log\LogUserDelete', [$user]);
        $this->dispatcher->dispatch('delete_user', 'DeleteUser', [$user]);
    }
804075
protected function handle(Event $event)
    {
        $method = $this->getApplyMethod($event);
        if (!method_exists($this, $method)) {
            return;
        }
        $this->$method($event);
    }
1335927
public function handle(JobDeleted $event)
    {
        if ($event->job->hasFailed()) {
            return;
        }

        $time = $this->watch->check($event->payload->id());

        $this->metrics->incrementQueue(
            $event->job->getQueue(), $time
        );

        $this->metrics->incrementJob(
            $event->payload->displayName(), $time
        );
    }
1053009
public function beforeDelete(Delete $event)
    {
        $pmkVal = $event->primaryKey;
        $entFrk = $this->getForeignKey();
        Sql::createSql($this->getEntity()->getAdapter())
            ->delete($this->getRelationTable())
            ->where(
                [
                    "{$entFrk} = :id" => [
                        ":id" => $pmkVal
                    ]
                ]
            )
            ->execute();
    }
57199
public function preDelete(DeleteEvent $event)
    {
        $homeTab = $event->getObject();

        foreach ($homeTab->getWidgetContainers() as $container) {
            $this->containerCrud->delete($container);
            $this->om->remove($container);
        }

        foreach ($homeTab->getHomeTabConfigs() as $config) {
            $this->om->remove($config);
        }

        $this->om->flush();
    }
49109
protected function handle($event): void
    {
        $method = $this->getApplyMethod($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
326933
public function afterDelete(Event $Event) {
		if ($this->_checkEvent($Event)) {
			$record = $Event->getData('record');
			$string = $this->_buildPath($record, true, null);
			if ($this->adapterClass === 'AmazonS3' || $this->adapterClass === 'AwsS3') {
				$string = str_replace('\\', '/', $string);
			}
			try {
				$Storage = StorageManager::adapter($record['adapter']);
				if (!$Storage->has($string)) {
					$Event->stopPropagation();
					$Event->result = false;

					return false;
				}
				$Storage->delete($string);
			} catch (\Exception $e) {
				$this->log($e->getMessage());
				$Event->stopPropagation();
				$Event->result = false;

				return false;
			}
			$operations = Configure::read('FileStorage.imageSizes.' . $record['model']);
			if (!empty($operations)) {
				$Event->setData('operations', $operations);
				$this->_removeVersions($Event);
			}
			$Event->stopPropagation();
			$Event->result = true;

			return true;
		}
	}
225540
public function preDelete(DeleteEvent $event)
    {
        $aggregate = $event->getObject();

        foreach ($aggregate->getAnnouncements() as $announcement) {
            $this->crud->delete($announcement);
        }
    }
970145
public static function create_delete_data_request(\core\event\user_deleted $event) {
        // Automatic creation of deletion requests must be enabled.
        if (get_config('tool_dataprivacy', 'automaticdeletionrequests')) {
            $requesttypes = [api::DATAREQUEST_TYPE_DELETE];
            $requeststatuses = [api::DATAREQUEST_STATUS_COMPLETE, api::DATAREQUEST_STATUS_DELETED];

            $hasongoingdeleterequests = api::has_ongoing_request($event->objectid, $requesttypes[0]);
            $hascompleteddeleterequest = (api::get_data_requests_count($event->objectid, $requeststatuses,
                    $requesttypes) > 0) ? true : false;

            if (!$hasongoingdeleterequests && !$hascompleteddeleterequest) {
                api::create_data_request($event->objectid, $requesttypes[0],
                        get_string('datarequestcreatedupondelete', 'tool_dataprivacy'),
                        data_request::DATAREQUEST_CREATION_AUTO);
            }
        }
    }
1098560
public function onDelete(DeleteResourceEvent $event)
    {
        $this->manager->delete($event->getResource());
        $event->stopPropagation();
    }
1273095
public function removeEvent($event, $table = ':any')
    {
        if ($table != ':any') {
            $table = $this->addTablePrefix($table, false);
        }

        return $this->connection->getEventHandler()->removeEvent($event, $table);
    }
881764
function handle(Event $event)
    {
        if ($this->accept($event)) {
            $this->onEvent($event);
            return true;
        }

        return false;
    }
692900
public function leave(Event $event)
    {
        $this->authorize('join', Event::class);
        $event->deleteUser(User::findOrfail(Auth::id()));

        return redirect()->route('laralum::events.index')
            ->with('success', __('laralum_events::general.left_event', ['id' => $event->id]));
    }
1364130
public function removeEvent($event) {
		$result = remove_entity_relationship($event->guid, self::EVENT_CALENDAR_RELATIONSHIP, $this->guid);

		if ($result) {
			// allow events to fire after confirmation that it has been added to the calendar
			elgg_trigger_event('events_api', 'remove_from_calendar', array('event' => $event, 'calendar' => $this));
		}

		return $result;
	}
83676
public function onDelete(DeleteResourceEvent $event)
    {
        $ds = DIRECTORY_SEPARATOR;

        /** @var File $resource */
        $resource = $event->getResource();
        $workspace = $resource->getResourceNode()->getWorkspace();
        $hashName = $resource->getHashName();

        $archiveFile = $this->filesDir.$ds.'webresource'.$ds.$workspace->getUuid().$ds.$hashName;
        $webResourcesPath = $this->uploadDir.$ds.'webresource'.$ds.$workspace->getUuid().$ds.$hashName;

        if (file_exists($archiveFile)) {
            $event->setFiles([$archiveFile]);
        }
        if (file_exists($webResourcesPath)) {
            try {
                $this->deleteFiles($webResourcesPath);
            } catch (\Exception $e) {
            }
        }
        $this->om->remove($resource);
        $event->stopPropagation();
    }
297133
public function deleteImage(EventInterface $event) {
        $request = $event->getRequest();

        $event->getDatabase()->deleteImage(
            $request->getUser(),
            $request->getImageIdentifier()
        );
    }