events/Classes/Command/RemoveAllCommand.php

35 lines
889 B
PHP
Raw Normal View History

2019-08-12 07:43:37 +02:00
<?php
declare(strict_types=1);
namespace WerkraumMedia\Events\Command;
2019-08-12 07:43:37 +02:00
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Core\Bootstrap;
use WerkraumMedia\Events\Service\CleanupService;
2019-08-12 07:43:37 +02:00
class RemoveAllCommand extends Command
{
public function __construct(
private readonly CleanupService $cleanupService
) {
parent::__construct();
}
public function configure(): void
2019-08-12 07:43:37 +02:00
{
$this->setDescription('Remove all event data');
$this->setHelp('All events and associated data will be removed.');
2019-08-12 07:43:37 +02:00
}
2024-02-19 09:20:12 +01:00
protected function execute(InputInterface $input, OutputInterface $output): int
2019-08-12 07:43:37 +02:00
{
Bootstrap::initializeBackendAuthentication();
$this->cleanupService->deleteAllData();
return 0;
2019-08-12 07:43:37 +02:00
}
}