mirror of
https://github.com/werkraum-media/events.git
synced 2024-12-27 11:46:09 +01:00
Daniel Siepmann
a8c475fbd7
TYPO3 scheduler tasks always have a value for console commands. Region uid will be an empty string if omitted within scheduler task. We reflect that in our tests and adapt code to not break. Furthermore tests call only with strings, as that's what TYPO3 does.
71 lines
2 KiB
PHP
71 lines
2 KiB
PHP
<?php
|
|
|
|
namespace Wrm\Events\Command;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use TYPO3\CMS\Core\Core\Bootstrap;
|
|
use Wrm\Events\Service\DestinationDataImportService;
|
|
|
|
class DestinationDataImportCommand extends Command
|
|
{
|
|
/**
|
|
* @var DestinationDataImportService
|
|
*/
|
|
private $destinationDataImportService;
|
|
|
|
public function __construct(
|
|
DestinationDataImportService $destinationDataImportService
|
|
) {
|
|
parent::__construct();
|
|
$this->destinationDataImportService = $destinationDataImportService;
|
|
}
|
|
|
|
public function configure(): void
|
|
{
|
|
$this->setDescription('Import Destination Data Events');
|
|
$this->setHelp('Destination Data Events are imported');
|
|
|
|
$this->addArgument(
|
|
'storage-pid',
|
|
InputArgument::REQUIRED,
|
|
'What is the storage pid?'
|
|
);
|
|
$this->addArgument(
|
|
'rest-experience',
|
|
InputArgument::REQUIRED,
|
|
'What is the rest experience?'
|
|
);
|
|
$this->addArgument(
|
|
'files-folder',
|
|
InputArgument::REQUIRED,
|
|
'Where to save the image files?'
|
|
);
|
|
$this->addArgument(
|
|
'region-uid',
|
|
InputArgument::OPTIONAL,
|
|
'What is the region uid?'
|
|
);
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
Bootstrap::initializeBackendAuthentication();
|
|
|
|
$regionUid = $input->getArgument('region-uid');
|
|
if (is_numeric($regionUid)) {
|
|
$regionUid = (int) $regionUid;
|
|
} else {
|
|
$regionUid = null;
|
|
}
|
|
|
|
return $this->destinationDataImportService->import(
|
|
$input->getArgument('rest-experience'),
|
|
$input->getArgument('storage-pid'),
|
|
$regionUid,
|
|
$input->getArgument('files-folder')
|
|
);
|
|
}
|
|
}
|