feat: ep:import-dates command on TYPO3 13

- Registered with #[AsCommand]; Configuration/Commands.php is no
  longer read
- Storage page of the imported records from the extension
  configuration (importStoragePid, 11 as in all site templates):
  frontend TypoScript is not available on the CLI in TYPO3 13
- The reseller and travel info page cache flush is gone with those
  plugins; the import still clears the page cache

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-21 15:19:13 +02:00
1 parent 5227da2381
commit bc2a914b67
5 files changed
+13 -61

No files matched your search

+1
View File
@@ -46,6 +46,7 @@ return [
'contentFeedLanguages' => '0',
'contentFeedNewsDetailPages' => 'ep-reisen:1392',
'contentFeedSites' => 'ep-reisen,ser,ski-boarderweek,ski-wochenenden,snowzone',
'importStoragePid' => '11',
'myEpApiBaseUrl' => '',
'myEpApiClientId' => '',
'myEpApiClientSecret' => '',
@@ -29,12 +29,12 @@ namespace EP\EpProducts\Command;
use EP\EpProducts\Service\DateImportService;
use EP\EpProducts\Service\ProductImportSource;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Service\CacheService;
#[AsCommand(name: 'ep:import-dates', description: 'Imports travel dates, rooms and prices from the MyE&P product export')]
class DateCommandController extends Command
{
@@ -43,16 +43,6 @@ class DateCommandController extends Command
*/
protected $dateImportService;
/**
* @var CacheService
*/
protected $cacheService;
/**
* @var ConfigurationManagerInterface
*/
protected $configurationManager;
/**
* @var ProductImportSource
*/
@@ -60,21 +50,15 @@ class DateCommandController extends Command
/**
* @param DateImportService $importService
* @param CacheService $cacheService
* @param ConfigurationManagerInterface $configurationManager
* @param ProductImportSource $importSource
*/
public function __construct
(
DateImportService $importService,
CacheService $cacheService,
ConfigurationManagerInterface $configurationManager,
ProductImportSource $importSource
)
{
$this->dateImportService = $importService;
$this->cacheService = $cacheService;
$this->configurationManager = $configurationManager;
$this->importSource = $importSource;
parent::__construct();
@@ -95,25 +79,11 @@ class DateCommandController extends Command
$count = $this->dateImportService->import($import->getRows());
$this->importSource->markImported($import);
// DateImportService::import() clears the page cache
$output->writeln(sprintf('%d rows imported.', $count ));
$settings = $this->getSettings();
$resellerPageUid = $settings['resellerExportPageUid'];
$travelInfoPageUid = $settings['travelInfoPageUid'];
$this->cacheService->clearPageCache([$resellerPageUid, $travelInfoPageUid]);
return 0;
}
/**
* @return array
*/
protected function getSettings(): array
{
$settings = $this
->configurationManager
->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
return $settings['plugin.']['tx_epproducts.']['settings.'];
}
}
@@ -32,9 +32,8 @@ use EP\EpProducts\Domain\Model\Room;
use EP\EpProducts\Traits\DbConnectionTrait;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Service\CacheService;
class DateImportService implements SingletonInterface, LoggerAwareInterface
@@ -86,11 +85,6 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
*/
const SELECTION_GROUP_LABEL_PERSONNEL = 'Leistungen Personal';
/**
* @var ConfigurationManagerInterface
*/
protected $configurationManager;
/**
* @var int
*/
@@ -129,31 +123,24 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
];
/**
* @param ConfigurationManagerInterface $configurationManager
* @param ExtensionConfiguration $extensionConfiguration
* @param CacheService $cacheService
* @param ProductImportSource $importSource
* @param RoomTypeResolver $roomTypeResolver
*/
public function __construct(
ConfigurationManagerInterface $configurationManager,
ExtensionConfiguration $extensionConfiguration,
CacheService $cacheService,
ProductImportSource $importSource,
RoomTypeResolver $roomTypeResolver
) {
$this->configurationManager = $configurationManager;
$this->cacheService = $cacheService;
$this->importSource = $importSource;
$this->roomTypeResolver = $roomTypeResolver;
$settings = GeneralUtility::removeDotsFromTS(
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
);
if (isset($settings['plugin']['tx_epproducts']['persistence']['storagePid'])) {
$this->pid = $settings['plugin']['tx_epproducts']['persistence']['storagePid'];
} elseif (isset($settings['module']['tx_epproducts']['persistence']['storagePid'])) {
$this->pid = $settings['module']['tx_epproducts']['persistence']['storagePid'];
}
// Extension configuration rather than TypoScript: the import runs on the CLI, where
// TYPO3 13 has no frontend TypoScript (plugin.tx_epproducts.persistence.storagePid)
$this->pid = (int)$extensionConfiguration->get('ep_products', 'importStoragePid');
}
/**
@@ -1,9 +0,0 @@
<?php
use EP\EpProducts\Command\DateCommandController;
return [
'ep:import-dates' => [
'class' => DateCommandController::class,
],
];
@@ -57,3 +57,6 @@ contentFeedExcludedPages = 634
# cat=ContentFeed; type=string; label=News detail page per site for the chatbot content feed (identifier:pageUid, comma-separated)
contentFeedNewsDetailPages = ep-reisen:1392
# cat=Import; type=int+; label=Storage page of the imported dates and rooms
importStoragePid = 11