mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-25 00:36:10 +01:00
Daniel Siepmann
3d6bf0ac8a
It is now possible to create "Import" records in TYPO3 system. Those records can then be imported via two new commands. There is no need to configure everything within the command itself. That allows: * To allow editors to maintain import configuration. * Have proper labels, description, csh and UI to create import. It no longer is necessary to copy UIDs, instead proper wizards from TCA are available to select pages. Relates: #9649
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Wrm\Events\Service\DestinationDataImportService;
|
|
|
|
use TYPO3\CMS\Core\Http\Uri;
|
|
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
|
|
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
|
use Wrm\Events\Domain\Model\Import;
|
|
|
|
/**
|
|
* Factory to create URLs used during import of Destination Data.
|
|
*/
|
|
class UrlFactory
|
|
{
|
|
/**
|
|
* @var array
|
|
*/
|
|
private $settings = [];
|
|
|
|
public function __construct(
|
|
ConfigurationManager $configurationManager
|
|
) {
|
|
$this->settings = $configurationManager->getConfiguration(
|
|
ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS,
|
|
'Events',
|
|
'Pi1'
|
|
)['destinationData'] ?? [];
|
|
}
|
|
|
|
/**
|
|
* URL used to fetch initial set of data.
|
|
*/
|
|
public function createSearchResultUrl(
|
|
Import $import
|
|
): string {
|
|
$parameter = [
|
|
'experience' => $import->getRestExperience(),
|
|
'licensekey' => $this->settings['license'] ?? '',
|
|
'type' => $this->settings['restType'] ?? '',
|
|
'mode' => $this->settings['restMode'] ?? '',
|
|
'limit' => $this->settings['restLimit'] ?? '',
|
|
'template' => $this->settings['restTemplate'] ?? '',
|
|
'q' => $import->getSearchQuery()
|
|
];
|
|
|
|
$parameter = array_filter($parameter);
|
|
|
|
$url = new Uri($this->settings['restUrl']);
|
|
$url = $url->withQuery(http_build_query($parameter));
|
|
return (string) $url;
|
|
}
|
|
}
|