events/Classes/Command/DestinationDataImportCommand.php

62 lines
1.8 KiB
PHP
Raw Normal View History

2019-08-12 07:43:37 +02:00
<?php
2019-08-12 07:43:37 +02:00
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 TYPO3\CMS\Core\Utility\GeneralUtility;
2019-08-13 11:17:34 +02:00
use TYPO3\CMS\Extbase\Object\ObjectManager;
use Wrm\Events\Service\DestinationDataImportService;
2019-08-12 07:43:37 +02:00
class DestinationDataImportCommand extends Command
{
2019-08-12 07:43:37 +02:00
public function configure()
{
$this->setDescription('Import Destination Data Events');
$this->setHelp('Destination Data Events are imported');
$this->addArgument(
'storage-pid',
InputArgument::OPTIONAL,
'What is the storage pid?',
2020-08-19 11:30:13 +02:00
'6'
2019-08-12 07:43:37 +02:00
);
$this->addArgument(
'region-uid',
InputArgument::OPTIONAL,
'What is the region uid?',
2020-08-19 11:30:13 +02:00
'1'
2019-08-12 07:43:37 +02:00
);
$this->addArgument(
'rest-experience',
2019-08-12 07:43:37 +02:00
InputArgument::OPTIONAL,
'What is the rest experience?',
2019-10-09 15:03:58 +02:00
'stadtmarketing-erfurt'
2019-08-12 07:43:37 +02:00
);
$this->addArgument(
'files-folder',
2019-08-12 07:43:37 +02:00
InputArgument::OPTIONAL,
'Where to save the image files?',
2019-10-09 15:03:58 +02:00
'staedte/erfurt/events/'
2019-08-12 07:43:37 +02:00
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
Bootstrap::initializeBackendAuthentication();
2019-08-13 11:17:34 +02:00
return GeneralUtility::makeInstance(ObjectManager::class)
->get(DestinationDataImportService::class)
->import(
$input->getArgument('rest-experience'),
$input->getArgument('storage-pid'),
$input->getArgument('region-uid'),
$input->getArgument('files-folder')
);
2019-08-12 07:43:37 +02:00
}
}