mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-10 07:36:09 +01:00
Use dependency injection within command
Do not fetch service with legacy API, instead use proper Dependency Injection. Relates: #9532
This commit is contained in:
parent
c2e648b2c5
commit
a576709947
1 changed files with 18 additions and 10 deletions
|
@ -7,12 +7,22 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use TYPO3\CMS\Core\Core\Bootstrap;
|
use TYPO3\CMS\Core\Core\Bootstrap;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
||||||
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
|
||||||
use Wrm\Events\Service\DestinationDataImportService;
|
use Wrm\Events\Service\DestinationDataImportService;
|
||||||
|
|
||||||
class DestinationDataImportCommand extends Command
|
class DestinationDataImportCommand extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var DestinationDataImportService
|
||||||
|
*/
|
||||||
|
private $destinationDataImportService;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
DestinationDataImportService $destinationDataImportService
|
||||||
|
) {
|
||||||
|
parent::__construct();
|
||||||
|
$this->destinationDataImportService = $destinationDataImportService;
|
||||||
|
}
|
||||||
|
|
||||||
public function configure(): void
|
public function configure(): void
|
||||||
{
|
{
|
||||||
$this->setDescription('Import Destination Data Events');
|
$this->setDescription('Import Destination Data Events');
|
||||||
|
@ -48,9 +58,7 @@ class DestinationDataImportCommand extends Command
|
||||||
{
|
{
|
||||||
Bootstrap::initializeBackendAuthentication();
|
Bootstrap::initializeBackendAuthentication();
|
||||||
|
|
||||||
return GeneralUtility::makeInstance(ObjectManager::class)
|
return $this->destinationDataImportService->import(
|
||||||
->get(DestinationDataImportService::class)
|
|
||||||
->import(
|
|
||||||
$input->getArgument('rest-experience'),
|
$input->getArgument('rest-experience'),
|
||||||
$input->getArgument('storage-pid'),
|
$input->getArgument('storage-pid'),
|
||||||
$input->getArgument('region-uid'),
|
$input->getArgument('region-uid'),
|
||||||
|
|
Loading…
Reference in a new issue