From 9464ad601811ec512810699090dfa641787ab244 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 1 Oct 2020 08:34:13 +0200 Subject: [PATCH] Add lanuage handling --- Classes/Domain/Model/Date.php | 20 +++++++++++++++++++ Classes/Domain/Model/Event.php | 20 +++++++++++++++++++ Classes/Domain/Model/Organizer.php | 20 +++++++++++++++++++ Classes/Domain/Model/Region.php | 20 +++++++++++++++++++ .../Service/DestinationDataImportService.php | 8 ++++++++ composer.json | 3 +-- ext_emconf.php | 2 +- ext_localconf.php | 15 -------------- 8 files changed, 90 insertions(+), 18 deletions(-) diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index d56d370..025ad45 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -23,6 +23,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity */ protected $event = null; + /** + * @var int + */ + protected $languageUid; + /** * @return \DateTime $start */ @@ -74,4 +79,19 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity return $this; } + /** + * @param int $languageUid + * @return void + */ + public function setLanguageUid($languageUid) { + $this->languageUid = $languageUid; + } + + /** + * @return int + */ + public function getLanguageUid() { + return $this->languageUid; + } + } diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 37a0fc4..ce4091a 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -198,6 +198,11 @@ class Event extends AbstractEntity */ protected $categories; + /** + * @var int + */ + protected $languageUid; + /** * __construct */ @@ -702,4 +707,19 @@ class Event extends AbstractEntity { $this->categories = $categories; } + + /** + * @param int $languageUid + * @return void + */ + public function setLanguageUid($languageUid) { + $this->languageUid = $languageUid; + } + + /** + * @return int + */ + public function getLanguageUid() { + return $this->languageUid; + } } diff --git a/Classes/Domain/Model/Organizer.php b/Classes/Domain/Model/Organizer.php index 643549b..5d1848d 100644 --- a/Classes/Domain/Model/Organizer.php +++ b/Classes/Domain/Model/Organizer.php @@ -74,6 +74,11 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity */ protected $email = ''; + /** + * @var int + */ + protected $languageUid; + /** * Returns the name * @@ -263,4 +268,19 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity protected function initStorageObjects() { } + + /** + * @param int $languageUid + * @return void + */ + public function setLanguageUid($languageUid) { + $this->languageUid = $languageUid; + } + + /** + * @return int + */ + public function getLanguageUid() { + return $this->languageUid; + } } diff --git a/Classes/Domain/Model/Region.php b/Classes/Domain/Model/Region.php index 3cba915..60b8e7e 100644 --- a/Classes/Domain/Model/Region.php +++ b/Classes/Domain/Model/Region.php @@ -24,6 +24,11 @@ class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @var string */ protected $title = ''; + + /** + * @var int + */ + protected $languageUid; /** * Returns the title @@ -67,4 +72,19 @@ class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity protected function initStorageObjects() { } + + /** + * @param int $languageUid + * @return void + */ + public function setLanguageUid($languageUid) { + $this->languageUid = $languageUid; + } + + /** + * @return int + */ + public function getLanguageUid() { + return $this->languageUid; + } } diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 5fbca2d..87c1155 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -260,6 +260,9 @@ class DestinationDataImportService { // Event already exists? If not create one! $this->tmpCurrentEvent = $this->getOrCreateEvent($event['global_id'], $event['title']); + // Set language UID + $this->tmpCurrentEvent->setLanguageUid(-1); + // Set selected Region $this->tmpCurrentEvent->setRegion($selectedRegion); @@ -369,6 +372,8 @@ class DestinationDataImportService { $end = new \DateTime($date['end'], new \DateTimeZone($date['tz'])); $this->logger->info('Start transformed ' . $start->format('Y-m-d H:i')); $this->logger->info('End transformed ' . $end->format('Y-m-d H:i')); + // Set language UID + $dateObj->setLanguageUid(-1); $dateObj->setStart($start); $dateObj->setEnd($end); $this->tmpCurrentEvent->addDate($dateObj); @@ -393,6 +398,7 @@ class DestinationDataImportService { $eventEnd->setTimestamp($i); $eventEnd->setTime($until->format('H'), $until->format('i')); $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj->setLanguageUid(-1); $dateObj->setStart($eventStart); $dateObj->setEnd($eventEnd); $this->tmpCurrentEvent->addDate($dateObj); @@ -418,6 +424,7 @@ class DestinationDataImportService { $eventEnd->setTimestamp($i); $eventEnd->setTime($until->format('H'), $until->format('i')); $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj->setLanguageUid(-1); $dateObj->setStart($eventStart); $dateObj->setEnd($eventEnd); $this->tmpCurrentEvent->addDate($dateObj); @@ -443,6 +450,7 @@ class DestinationDataImportService { continue; } $tmpOrganizer = $this->objectManager->get(\Wrm\Events\Domain\Model\Organizer::class); + $tmpOrganizer->setLanguageUid(-1); $tmpOrganizer->setName($address['name']); $tmpOrganizer->setCity($address['city']); $tmpOrganizer->setZip($address['zip']); diff --git a/composer.json b/composer.json index b926898..02b7e15 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,6 @@ "role": "Developer" } ], - "version": "1.0.0", "require": { "typo3/cms-core": "^9.5" }, @@ -26,4 +25,4 @@ "events": "self.version", "typo3-ter/events": "self.version" } -} \ No newline at end of file +} diff --git a/ext_emconf.php b/ext_emconf.php index e434a35..604ace8 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -20,7 +20,7 @@ $EM_CONF[$_EXTKEY] = [ 'uploadfolder' => 1, 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '1.0.0', + 'version' => '1.0.1', 'constraints' => [ 'depends' => [ 'typo3' => '9.5.0-9.5.99', diff --git a/ext_localconf.php b/ext_localconf.php index 261c280..672dd3b 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -5,21 +5,6 @@ call_user_func( function() { - /* - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Wrm.Events', - 'Pi1', - [ - 'Event' => 'teaser, list, show, search', - 'Date' => 'teaser, list, show, search' - ], - [ - 'Event' => 'teaser, list, show, search', - 'Date' => 'teaser, list, show, search' - ] - ); - */ - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'Wrm.Events', 'DateSearch',