mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-24 16:16:09 +01:00
Make region optional during import
This commit is contained in:
parent
29c31375a5
commit
73161fa24e
4 changed files with 21 additions and 16 deletions
|
@ -30,27 +30,23 @@ class DestinationDataImportCommand extends Command
|
||||||
|
|
||||||
$this->addArgument(
|
$this->addArgument(
|
||||||
'storage-pid',
|
'storage-pid',
|
||||||
InputArgument::OPTIONAL,
|
InputArgument::REQUIRED,
|
||||||
'What is the storage pid?',
|
'What is the storage pid?'
|
||||||
'6'
|
|
||||||
);
|
);
|
||||||
$this->addArgument(
|
$this->addArgument(
|
||||||
'region-uid',
|
'region-uid',
|
||||||
InputArgument::OPTIONAL,
|
InputArgument::OPTIONAL,
|
||||||
'What is the region uid?',
|
'What is the region uid?'
|
||||||
'1'
|
|
||||||
);
|
);
|
||||||
$this->addArgument(
|
$this->addArgument(
|
||||||
'rest-experience',
|
'rest-experience',
|
||||||
InputArgument::OPTIONAL,
|
InputArgument::REQUIRED,
|
||||||
'What is the rest experience?',
|
'What is the rest experience?'
|
||||||
'stadtmarketing-erfurt'
|
|
||||||
);
|
);
|
||||||
$this->addArgument(
|
$this->addArgument(
|
||||||
'files-folder',
|
'files-folder',
|
||||||
InputArgument::OPTIONAL,
|
InputArgument::REQUIRED,
|
||||||
'Where to save the image files?',
|
'Where to save the image files?'
|
||||||
'staedte/erfurt/events/'
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ use Wrm\Events\Domain\Model\Category;
|
||||||
use Wrm\Events\Domain\Model\Date;
|
use Wrm\Events\Domain\Model\Date;
|
||||||
use Wrm\Events\Domain\Model\Event;
|
use Wrm\Events\Domain\Model\Event;
|
||||||
use Wrm\Events\Domain\Model\Organizer;
|
use Wrm\Events\Domain\Model\Organizer;
|
||||||
|
use Wrm\Events\Domain\Model\Region;
|
||||||
use Wrm\Events\Domain\Repository\CategoryRepository;
|
use Wrm\Events\Domain\Repository\CategoryRepository;
|
||||||
use Wrm\Events\Domain\Repository\DateRepository;
|
use Wrm\Events\Domain\Repository\DateRepository;
|
||||||
use Wrm\Events\Domain\Repository\EventRepository;
|
use Wrm\Events\Domain\Repository\EventRepository;
|
||||||
|
@ -72,7 +73,7 @@ class DestinationDataImportService
|
||||||
private $storagePid;
|
private $storagePid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var ?int
|
||||||
*/
|
*/
|
||||||
private $regionUid;
|
private $regionUid;
|
||||||
|
|
||||||
|
@ -221,7 +222,7 @@ class DestinationDataImportService
|
||||||
public function import(
|
public function import(
|
||||||
string $restExperience,
|
string $restExperience,
|
||||||
int $storagePid,
|
int $storagePid,
|
||||||
int $regionUid,
|
?int $regionUid,
|
||||||
string $filesFolder
|
string $filesFolder
|
||||||
): int {
|
): int {
|
||||||
$this->restExperience = $restExperience;
|
$this->restExperience = $restExperience;
|
||||||
|
@ -279,7 +280,10 @@ class DestinationDataImportService
|
||||||
$this->logger->info('Processing json ' . count($data['items']));
|
$this->logger->info('Processing json ' . count($data['items']));
|
||||||
|
|
||||||
// Get selected region
|
// Get selected region
|
||||||
$selectedRegion = $this->regionRepository->findByUid($this->regionUid);
|
$selectedRegion = null;
|
||||||
|
if (is_int($this->regionUid)) {
|
||||||
|
$selectedRegion = $this->regionRepository->findByUid($this->regionUid);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($data['items'] as $event) {
|
foreach ($data['items'] as $event) {
|
||||||
$this->logger->info('Processing event ' . substr($event['title'], 0, 20));
|
$this->logger->info('Processing event ' . substr($event['title'], 0, 20));
|
||||||
|
@ -291,7 +295,9 @@ class DestinationDataImportService
|
||||||
$this->tmpCurrentEvent->setLanguageUid(-1);
|
$this->tmpCurrentEvent->setLanguageUid(-1);
|
||||||
|
|
||||||
// Set selected Region
|
// Set selected Region
|
||||||
$this->tmpCurrentEvent->setRegion($selectedRegion);
|
if ($selectedRegion instanceof Region) {
|
||||||
|
$this->tmpCurrentEvent->setRegion($selectedRegion);
|
||||||
|
}
|
||||||
|
|
||||||
// Set Title
|
// Set Title
|
||||||
$this->tmpCurrentEvent->setTitle(substr($event['title'], 0, 254));
|
$this->tmpCurrentEvent->setTitle(substr($event['title'], 0, 254));
|
||||||
|
|
|
@ -9,6 +9,9 @@ Nothing
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
* ``region-uid`` of ``DestinationDataImportCommand`` is now optional.
|
||||||
|
No region will be fetched and assigned to Events if no uid is provided.
|
||||||
|
|
||||||
* ``DateDemandFactory`` supports TypoScript ``stdWrap`` on all settings on first level.
|
* ``DateDemandFactory`` supports TypoScript ``stdWrap`` on all settings on first level.
|
||||||
|
|
||||||
* New option ``queryCallback`` for ``DateDemand`` was added.
|
* New option ``queryCallback`` for ``DateDemand`` was added.
|
||||||
|
|
|
@ -11,7 +11,7 @@ parameters:
|
||||||
path: Classes/Command/DestinationDataImportCommand.php
|
path: Classes/Command/DestinationDataImportCommand.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#3 \\$regionUid of method Wrm\\\\Events\\\\Service\\\\DestinationDataImportService\\:\\:import\\(\\) expects int, mixed given\\.$#"
|
message: "#^Parameter \\#3 \\$regionUid of method Wrm\\\\Events\\\\Service\\\\DestinationDataImportService\\:\\:import\\(\\) expects int\\|null, mixed given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: Classes/Command/DestinationDataImportCommand.php
|
path: Classes/Command/DestinationDataImportCommand.php
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue