Give services more meaningful names, use proper di

This commit is contained in:
Björn Fromme
2018-09-26 19:17:28 +02:00
parent f14e062e04
commit 6ecdc3f890
23 changed files with 179 additions and 135 deletions
@@ -27,6 +27,7 @@ namespace EP\EpProducts\Command;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Service\ContingentImportService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
@@ -34,15 +35,22 @@ class ContingentCommandController extends CommandController
{
/**
* @var \EP\EpProducts\Service\ContingentService
* @inject
* @var ContingentImportService
*/
protected $contingentService;
protected $contingentImportService;
/**
* @param ContingentImportService $contingentImportService
*/
public function __construct(ContingentImportService $contingentImportService)
{
$this->contingentImportService = $contingentImportService;
}
public function importCommand()
{
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexportzimmer');
$count = $this->contingentService->import($path);
$count = $this->contingentImportService->import($path);
$this->outputLine('%d rows imported.', [ $count ]);
}
@@ -27,7 +27,7 @@ namespace EP\EpProducts\Command;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Service\ImportService;
use EP\EpProducts\Service\DatesImportService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
@@ -37,9 +37,9 @@ class ProductCommandController extends CommandController
{
/**
* @var \EP\EpProducts\Service\ImportService
* @var \EP\EpProducts\Service\DatesImportService
*/
protected $importService;
protected $datesImportService;
/**
* @var CacheService
@@ -52,13 +52,18 @@ class ProductCommandController extends CommandController
protected $configurationManager;
/**
* @param ImportService $importService
* @param DatesImportService $datesImportService
* @param CacheService $cacheService
* @param ConfigurationManagerInterface $configurationManager
*/
public function __construct(ImportService $importService, CacheService $cacheService, ConfigurationManagerInterface $configurationManager)
public function __construct
(
DatesImportService $datesImportService,
CacheService $cacheService,
ConfigurationManagerInterface $configurationManager
)
{
$this->importService = $importService;
$this->datesImportService = $datesImportService;
$this->cacheService = $cacheService;
$this->configurationManager = $configurationManager;
}
@@ -66,10 +71,10 @@ class ProductCommandController extends CommandController
public function importCommand()
{
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
if ($this->importService->checkActiveUpload($path)) {
if ($this->datesImportService->checkActiveUpload($path)) {
$this->outputLine('Import cancelled due to active file upload.');
} else {
$count = $this->importService->import($path);
$count = $this->datesImportService->import($path);
$this->outputLine('%d rows imported.', [ $count ]);
$settings = $this->getSettings();
$resellerPageUid = $settings['resellerExportPageUid'];
@@ -27,21 +27,29 @@ namespace EP\EpProducts\Command;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Service\SnowreportImportService;
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
class SnowreportCommandController extends CommandController
{
/**
* @var \EP\EpProducts\Service\SnowreportService
* @inject
* @var SnowreportImportService
*/
protected $snowreportService;
protected $snowreportImportService;
/**
* @param SnowreportImportService $snowreportImportService
*/
public function __construct(SnowreportImportService $snowreportImportService)
{
$this->snowreportImportService = $snowreportImportService;
}
public function importCommand()
{
$this->snowreportService->downloadReportsXml();
$count = $this->snowreportService->importSnowReportData();
$this->snowreportImportService->downloadReportsXml();
$count = $this->snowreportImportService->importSnowReportData();
$this->outputLine('%d rows imported.', [ $count ]);
}
@@ -33,7 +33,7 @@ use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Service\DateService;
use EP\EpProducts\Service\FilterService;
use EP\EpProducts\Service\ResellerService;
use EP\EpProducts\Service\ResellerDataService;
use EP\EpProducts\Traits\RequestArgumentTypeConversionTrait;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -55,9 +55,9 @@ class AjaxDateController extends ActionController
protected $dateService;
/**
* @var ResellerService
* @var ResellerDataService
*/
protected $resellerService;
protected $resellerDataService;
/**
* @var ProductRepository
@@ -67,21 +67,21 @@ class AjaxDateController extends ActionController
/**
* @param FilterService $filterService
* @param DateService $dateService
* @param ResellerService $resellerService
* @param ResellerDataService $resellerDataService
* @param ProductRepository $productRepository
*/
public function __construct
(
FilterService $filterService,
DateService $dateService,
ResellerService $resellerService,
ResellerDataService $resellerDataService,
ProductRepository $productRepository
)
{
parent::__construct();
$this->filterService = $filterService;
$this->dateService = $dateService;
$this->resellerService = $resellerService;
$this->resellerDataService = $resellerDataService;
$this->productRepository = $productRepository;
}
@@ -127,7 +127,7 @@ class AjaxDateController extends ActionController
$altLabel = $product->getAltLabel();
}
}
if ($reseller = $this->resellerService->getResellerForCurrentDomain()) {
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode'];
} else {
$paCode = null;
@@ -33,7 +33,7 @@ use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Service\DateService;
use EP\EpProducts\Service\FilterService;
use EP\EpProducts\Service\ResellerService;
use EP\EpProducts\Service\ResellerDataService;
use EP\EpProducts\Traits\RequestArgumentTypeConversionTrait;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -54,21 +54,26 @@ class AjaxTableController extends ActionController
protected $dateService;
/**
* @var ResellerService
* @var ResellerDataService
*/
protected $resellerService;
protected $resellerDataService;
/**
* @param DateService $dateService
* @param FilterService $filterService
* @param ResellerService $resellerService
* @param ResellerDataService $resellerDataService
*/
public function __construct(DateService $dateService, FilterService $filterService, ResellerService $resellerService)
public function __construct
(
DateService $dateService,
FilterService $filterService,
ResellerDataService $resellerDataService
)
{
parent::__construct();
$this->dateService = $dateService;
$this->filterService = $filterService;
$this->resellerService = $resellerService;
$this->resellerDataService = $resellerDataService;
}
public function initializeAction()
@@ -91,7 +96,7 @@ class AjaxTableController extends ActionController
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid, false);
}
if ($reseller = $this->resellerService->getResellerForCurrentDomain()) {
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode'];
} else {
$paCode = null;
@@ -118,7 +123,7 @@ class AjaxTableController extends ActionController
*/
public function pricetableHtmlAction(Product $product, Hotel $hotel)
{
if ($reseller = $this->resellerService->getResellerForCurrentDomain()) {
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode'];
} else {
$paCode = null;
@@ -27,6 +27,10 @@ namespace EP\EpProducts\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Service\ContingentImportService;
use EP\EpProducts\Service\DatesImportService;
use EP\EpProducts\Service\LogService;
use EP\EpProducts\Service\SnowreportImportService;
use TYPO3\CMS\Backend\View\BackendTemplateView;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -45,43 +49,60 @@ class BackendController extends ActionController
protected $view;
/**
* @var \EP\EpProducts\Service\ImportService
* @inject
* @var \EP\EpProducts\Service\DatesImportService
*/
protected $importService;
protected $datesImportService;
/**
* @var \EP\EpProducts\Service\ContingentService
* @inject
* @var \EP\EpProducts\Service\ContingentImportService
*/
protected $contingentService;
protected $contingentImportService;
/**
* @var \EP\EpProducts\Service\SnowreportService
* @inject
* @var \EP\EpProducts\Service\SnowreportImportService
*/
protected $snowreportService;
protected $snowreportImportService;
/**
* @var \EP\EpProducts\Service\LogService
* @inject
*/
protected $logService;
/**
* @param DatesImportService $datesImportService
* @param ContingentImportService $contingentImportService
* @param SnowreportImportService $snowreportImportService
* @param LogService $logService
*/
public function __construct
(
DatesImportService $datesImportService,
ContingentImportService $contingentImportService,
SnowreportImportService $snowreportImportService,
LogService $logService
)
{
parent::__construct();
$this->datesImportService = $datesImportService;
$this->contingentImportService = $contingentImportService;
$this->snowreportImportService = $snowreportImportService;
$this->logService = $logService;
}
public function indexAction()
{}
public function importProductsAction()
{
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
if ($this->importService->checkActiveUpload($path)) {
if ($this->datesImportService->checkActiveUpload($path)) {
$this->addFlashMessage(
'Datenexport aus BusProNet aktiv. Import nicht möglich.',
'Import fehlgeschlagen',
AbstractMessage::WARNING
);
} else {
$dateCount = $this->importService->import($path);
$dateCount = $this->datesImportService->import($path);
$this->addFlashMessage($dateCount . ' Termine importiert', 'Import abgechlossen', AbstractMessage::OK);
$resellerPageUid = $this->settings['resellerExportPageUid'];
$this->cacheService->clearPageCache($resellerPageUid);
@@ -92,15 +113,15 @@ class BackendController extends ActionController
public function importContingentsAction()
{
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexportzimmer');
$count = $this->contingentService->import($path);
$count = $this->contingentImportService->import($path);
$this->addFlashMessage($count . ' Datensätze importiert', 'Import abgechlossen', AbstractMessage::OK);
$this->redirect('index');
}
public function importSnowReportAction()
{
$this->snowreportService->downloadReportsXml();
$count = $this->snowreportService->importSnowReportData();
$this->snowreportImportService->downloadReportsXml();
$count = $this->snowreportImportService->importSnowReportData();
$this->addFlashMessage($count . ' Datensätze importiert', 'Import abgechlossen', AbstractMessage::OK);
$this->redirect('index');
}
@@ -30,7 +30,7 @@ namespace EP\EpProducts\Controller;
use EP\EpProducts\Domain\Model\Concept;
use EP\EpProducts\Domain\Model\FilterSettings;
use EP\EpProducts\Domain\Repository\ConceptRepository;
use EP\EpProducts\Service\ProductService;
use EP\EpProducts\Service\ProductDataService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -43,19 +43,19 @@ class ConceptController extends ActionController
protected $conceptRepository;
/**
* @var \EP\EpProducts\Service\ProductService
* @var \EP\EpProducts\Service\ProductDataService
*/
protected $productService;
protected $productDataService;
/**
* @param ConceptRepository $conceptRepository
* @param ProductService $productService
* @param ProductDataService $productDataService
*/
public function __construct(ConceptRepository $conceptRepository, ProductService $productService)
public function __construct(ConceptRepository $conceptRepository, ProductDataService $productDataService)
{
parent::__construct();
$this->conceptRepository = $conceptRepository;
$this->productService = $productService;
$this->productDataService = $productDataService;
}
/**
@@ -71,7 +71,7 @@ class ConceptController extends ActionController
$filterSettings->setConceptUids([$concept->getUid()]);
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true);
$limit = $this->settings['showMoreLink'] ? 4 : 0;
$teasers = $this->productService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$teasers = $this->productDataService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$this->view->assignMultiple([
'teasers' => $teasers,
'concept' => $concept,
@@ -30,7 +30,7 @@ namespace EP\EpProducts\Controller;
use EP\EpProducts\Domain\Model\Country;
use EP\EpProducts\Domain\Model\FilterSettings;
use EP\EpProducts\Domain\Repository\CountryRepository;
use EP\EpProducts\Service\ProductService;
use EP\EpProducts\Service\ProductDataService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -43,19 +43,19 @@ class CountryController extends ActionController
protected $countryRepository;
/**
* @var ProductService
* @var ProductDataService
*/
protected $productService;
protected $productDataService;
/**
* @param CountryRepository $countryRepository
* @param ProductService $productService
* @param ProductDataService $productDataService
*/
public function __construct(CountryRepository $countryRepository, ProductService $productService)
public function __construct(CountryRepository $countryRepository, ProductDataService $productDataService)
{
parent::__construct();
$this->countryRepository = $countryRepository;
$this->productService = $productService;
$this->productDataService = $productDataService;
}
/**
@@ -71,7 +71,7 @@ class CountryController extends ActionController
$filterSettings->setCountryUids([$countryUid]);
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true);
$limit = $this->settings['showMoreLink'] ? 4 : 0;
$teasers = $this->productService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$teasers = $this->productDataService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$this->view->assign('teasers', $teasers);
$this->view->assign('country', $country);
$this->view->assign('filterSettings', $filterSettings);
@@ -31,8 +31,8 @@ use EP\EpProducts\Domain\Model\FilterSettings;
use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Repository\HotelRepository;
use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Service\HotelService;
use EP\EpProducts\Service\ProductService;
use EP\EpProducts\Service\HotelDataService;
use EP\EpProducts\Service\ProductDataService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -50,33 +50,34 @@ class HotelController extends ActionController
protected $productRepository;
/**
* @var \EP\EpProducts\Service\HotelService
* @var \EP\EpProducts\Service\HotelDataService
*/
protected $hotelService;
protected $hotelDataService;
/**
* @var ProductService
* @var ProductDataService
*/
protected $productService;
protected $productDataService;
/**
* @param HotelService $hotelService
* @param HotelDataService $hotelDataService
* @param HotelRepository $hotelRepository
* @param ProductRepository $productRepository
* @param ProductService $productService
* @param ProductDataService $productDataService
*/
public function __construct(
HotelService $hotelService,
public function __construct
(
HotelDataService $hotelDataService,
HotelRepository $hotelRepository,
ProductRepository $productRepository,
ProductService $productService
ProductDataService $productDataService
)
{
parent::__construct();
$this->hotelRepository = $hotelRepository;
$this->productRepository = $productRepository;
$this->hotelService = $hotelService;
$this->productService = $productService;
$this->hotelDataService = $hotelDataService;
$this->productDataService = $productDataService;
}
/**
@@ -95,7 +96,7 @@ class HotelController extends ActionController
$filterSettings->setHotelUid($hotelUid);
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true);
$limit = $this->settings['showMoreLink'] ? 4 : 0;
$teasers = $this->productService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$teasers = $this->productDataService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$this->view->assign('hotel', $hotel);
$this->view->assign('teasers', $teasers);
$this->view->assign('filterSettings', $filterSettings);
@@ -125,9 +126,9 @@ class HotelController extends ActionController
'category' => (int) $this->settings['category'],
'type' => (int) $this->settings['type'],
];
$bookable = $this->hotelService->getTeasersByCriteria($criteria);
$bookable = $this->hotelDataService->getTeasersByCriteria($criteria);
$bookableHotelUids = array_keys($bookable);
$nonBookable = $this->hotelService->getDateIndependentTeasersByCriteria($criteria, $bookableHotelUids);
$nonBookable = $this->hotelDataService->getDateIndependentTeasersByCriteria($criteria, $bookableHotelUids);
$this->view->assign('bookable', $bookable);
$this->view->assign('nonBookable', $nonBookable);
}
@@ -141,7 +142,7 @@ class HotelController extends ActionController
'category' => (int) $this->settings['category'],
'type' => (int) $this->settings['type'],
];
$hotels = $this->hotelService->getDateIndependentTeasersByCriteria($criteria);
$hotels = $this->hotelDataService->getDateIndependentTeasersByCriteria($criteria);
$this->view->assign('teasers', $hotels);
}
@@ -27,10 +27,8 @@ namespace EP\EpProducts\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Repository\HotelRepository;
use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Service\HotelService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -35,8 +35,8 @@ use EP\EpProducts\Domain\Repository\HotelRepository;
use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Service\DateService;
use EP\EpProducts\Service\FilterService;
use EP\EpProducts\Service\HotelService;
use EP\EpProducts\Service\ProductService;
use EP\EpProducts\Service\HotelDataService;
use EP\EpProducts\Service\ProductDataService;
use EP\EpProducts\Traits\RequestArgumentTypeConversionTrait;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -62,9 +62,9 @@ class ProductController extends ActionController
protected $filterService;
/**
* @var \EP\EpProducts\Service\ProductService
* @var \EP\EpProducts\Service\ProductDataService
*/
protected $productService;
protected $productDataService;
/**
* @var DateService
@@ -72,33 +72,33 @@ class ProductController extends ActionController
protected $dateService;
/**
* @var HotelService
* @var HotelDataService
*/
protected $hotelService;
protected $hotelDataService;
/**
* @param ProductRepository $productRepository
* @param ProductService $productService
* @param ProductDataService $productDataService
* @param HotelRepository $hotelRepository
* @param HotelService $hotelService
* @param HotelDataService $hotelDataService
* @param DateService $dateService
* @param FilterService $filterService
*/
public function __construct(
ProductRepository $productRepository,
ProductService $productService,
ProductDataService $productDataService,
HotelRepository $hotelRepository,
HotelService $hotelService,
HotelDataService $hotelDataService,
DateService $dateService,
FilterService $filterService
)
{
parent::__construct();
$this->productRepository = $productRepository;
$this->productService = $productService;
$this->productDataService = $productDataService;
$this->hotelRepository = $hotelRepository;
$this->dateService = $dateService;
$this->hotelService = $hotelService;
$this->hotelDataService = $hotelDataService;
$this->filterService = $filterService;
}
@@ -194,7 +194,7 @@ class ProductController extends ActionController
$referringPageUid = null
)
{
$hotels = $this->hotelService->getList($product);
$hotels = $this->hotelDataService->getList($product);
list ($productDateRangeFrom, $productDateRangeTo) = $this->filterService->getProductDateRange($product, $filterSettings);
$this->view->assignMultiple([
'filterSettings' => $filterSettings,
@@ -213,7 +213,7 @@ class ProductController extends ActionController
$dateAuto = !$this->settings['dateFrom'] && !$this->settings['dateTo'];
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true);
$limit = $this->settings['showMoreLink'] ? 4 : 0;
$teasers = $this->productService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$teasers = $this->productDataService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$this->view->assign('teasers', $teasers);
$this->view->assign('dateAuto', $dateAuto);
$this->view->assign('filterSettings', $filterSettings);
@@ -30,7 +30,7 @@ namespace EP\EpProducts\Controller;
use EP\EpProducts\Domain\Model\FilterSettings;
use EP\EpProducts\Domain\Model\Region;
use EP\EpProducts\Domain\Repository\RegionRepository;
use EP\EpProducts\Service\ProductService;
use EP\EpProducts\Service\ProductDataService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -43,19 +43,19 @@ class RegionController extends ActionController
protected $regionRepository;
/**
* @var \EP\EpProducts\Service\ProductService
* @var \EP\EpProducts\Service\ProductDataService
*/
protected $productService;
protected $productDataService;
/**
* @param RegionRepository $regionRepository
* @param ProductService $productService
* @param ProductDataService $productDataService
*/
public function __construct(RegionRepository $regionRepository, ProductService $productService)
public function __construct(RegionRepository $regionRepository, ProductDataService $productDataService)
{
parent::__construct();
$this->regionRepository = $regionRepository;
$this->productService = $productService;
$this->productDataService = $productDataService;
}
/**
@@ -71,7 +71,7 @@ class RegionController extends ActionController
$filterSettings->setRegionUids([$region->getUid()]);
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true);
$limit = $this->settings['showMoreLink'] ? 4 : 0;
$teasers = $this->productService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$teasers = $this->productDataService->getTeasergroup($filterSettings, $excludedConceptUids, $limit);
$this->view->assign('teasers', $teasers);
$this->view->assign('region', $region);
$this->view->assign('filterSettings', $filterSettings);
@@ -29,7 +29,7 @@ namespace EP\EpProducts\Controller;
use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Model\Reseller;
use EP\EpProducts\Service\ResellerService;
use EP\EpProducts\Service\ResellerDataService;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
@@ -39,17 +39,17 @@ class ResellerController extends ActionController
{
/**
* @var ResellerService
* @var ResellerDataService
*/
protected $resellerService;
protected $resellerDataService;
/**
* @param ResellerService $resellerService
* @param ResellerDataService $resellerDataService
*/
public function __construct(ResellerService $resellerService)
public function __construct(ResellerDataService $resellerDataService)
{
parent::__construct();
$this->resellerService = $resellerService;
$this->resellerDataService = $resellerDataService;
}
/**
@@ -80,7 +80,7 @@ class ResellerController extends ActionController
$this->redirect('list', null, null, [ 'reseller' => $reseller ]);
}
$productData = $this->resellerService->preprocessSingle($product, $reseller);
$productData = $this->resellerDataService->preprocessSingle($product, $reseller);
$this->view->assign('reseller', $reseller);
$this->view->assign('productData', $productData);
@@ -92,7 +92,7 @@ class ResellerController extends ActionController
*/
public function xmlAction(Reseller $reseller)
{
$data = $this->resellerService->preprocessAll($reseller);
$data = $this->resellerDataService->preprocessAll($reseller);
$encoders = [new XmlEncoder('products')];
$normalizers = [new ObjectNormalizer()];
@@ -119,7 +119,7 @@ class ResellerController extends ActionController
*/
public function csvAction(Reseller $reseller)
{
$data = $this->resellerService->preprocessAll($reseller, [ 'width' => '1200', 'maxHeight' => '630', 'cropVariant' => 'facebook' ]);
$data = $this->resellerDataService->preprocessAll($reseller, [ 'width' => '1200', 'maxHeight' => '630', 'cropVariant' => 'facebook' ]);
$filename = 'export_' . $reseller->getCode() . '_' . date('Y-m-d') . '.csv';
@@ -35,7 +35,7 @@ use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
class ContingentService implements SingletonInterface
class ContingentImportService implements SingletonInterface
{
const ROOMCODE_STATUS = 'BelKal';
@@ -36,7 +36,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Service\CacheService;
class ImportService implements SingletonInterface
class DatesImportService implements SingletonInterface
{
const CODE_PSEUDOPRICE = 'PDGS';
const CODE_BABYROOM = 'Baby';
@@ -32,7 +32,7 @@ use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Repository\HotelRepository;
use TYPO3\CMS\Core\SingletonInterface;
class HotelService implements SingletonInterface
class HotelDataService implements SingletonInterface
{
/**
@@ -32,7 +32,7 @@ use EP\EpProducts\Domain\Repository\HotelRepository;
use EP\EpProducts\Domain\Repository\ProductRepository;
use TYPO3\CMS\Core\SingletonInterface;
class ProductService implements SingletonInterface
class ProductDataService implements SingletonInterface
{
/**
@@ -38,7 +38,7 @@ use EP\EpProducts\Utility\DbUtility;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class ResellerService implements SingletonInterface
class ResellerDataService implements SingletonInterface
{
/**
* @var ProductRepository
@@ -33,7 +33,7 @@ use EP\EpProducts\Utility\SettingsUtility;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class SnowreportService implements SingletonInterface
class SnowreportImportService implements SingletonInterface
{
const XML_FILE_PATH = 'fileadmin/snowreport/snowreport.xml';
const XML_FILE_URL = 'http://www.skiresort-service.com/xml-feed/';
@@ -27,7 +27,7 @@ namespace EP\EpProducts\Task;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Service\ContingentService;
use EP\EpProducts\Service\ContingentImportService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Scheduler\Task\AbstractTask;
@@ -38,8 +38,8 @@ class ImportContingentsTask extends AbstractTask
{
/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var \EP\EpProducts\Service\ContingentService $importService */
$importService = $objectManager->get(ContingentService::class);
/** @var \EP\EpProducts\Service\ContingentImportService $importService */
$importService = $objectManager->get(ContingentImportService::class);
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexportzimmer');
$importService->import($path);
return true;
@@ -27,7 +27,7 @@ namespace EP\EpProducts\Task;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Service\ImportService;
use EP\EpProducts\Service\DatesImportService;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
@@ -39,8 +39,8 @@ class ImportProductsTask extends AbstractTask
{
/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var \EP\EpProducts\Service\ImportService $importService */
$importService = $objectManager->get(ImportService::class);
/** @var \EP\EpProducts\Service\DatesImportService $importService */
$importService = $objectManager->get(DatesImportService::class);
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
if ($importService->checkActiveUpload($path)) {
$message = GeneralUtility::makeInstance(FlashMessage::class, 'Import aborted due to active file upload', '', FlashMessage::WARNING);
@@ -27,7 +27,7 @@ namespace EP\EpProducts\Task;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Service\SnowreportService;
use EP\EpProducts\Service\SnowreportImportService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Scheduler\Task\AbstractTask;
@@ -38,9 +38,9 @@ class ImportSnowreportTask extends AbstractTask
{
/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$snowreportService = $objectManager->get(SnowreportService::class);
$snowreportService->downloadReportsXml();
$snowreportService->importSnowReportData();
$imporService = $objectManager->get(SnowreportImportService::class);
$imporService->downloadReportsXml();
$imporService->importSnowReportData();
return true;
}
}
@@ -31,11 +31,9 @@ use EP\EpProducts\Domain\Model\FilterSettings;
use EP\EpProducts\Domain\Repository\CityRepository;
use EP\EpProducts\Domain\Repository\ConceptRepository;
use EP\EpProducts\Domain\Repository\CountryRepository;
use EP\EpProducts\Domain\Repository\HotelRepository;
use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Domain\Repository\RegionRepository;
use EP\EpProducts\Service\HotelService;
use EP\EpProducts\Service\ProductService;
use EP\EpProducts\Service\HotelDataService;
use EP\EpProducts\Service\ProductDataService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -83,8 +81,8 @@ class TeaserProcessor implements DataProcessorInterface
$processedData['country'] = $country;
}
if ((int) $processedData['data']['tx_eptheme_context_hotel'] > 0) {
/** @var \EP\EpProducts\Service\HotelService $service */
$service = $objectManager->get(HotelService::class);
/** @var \EP\EpProducts\Service\HotelDataService $service */
$service = $objectManager->get(HotelDataService::class);
/** @var array $hotel */
$hotel = $service->getTeaser($processedData['data']['tx_eptheme_context_hotel']);
$processedData['hotel'] = $hotel;
@@ -117,9 +115,9 @@ class TeaserProcessor implements DataProcessorInterface
$filterSettings->setDateTo($dateTo);
}
/** @var \EP\EpProducts\Service\ProductService $productService */
$productService = $objectManager->get(ProductService::class);
$processedData['teaser'] = $productService->getTeaser($filterSettings);
/** @var \EP\EpProducts\Service\ProductDataService $productDataService */
$productDataService = $objectManager->get(ProductDataService::class);
$processedData['teaser'] = $productDataService->getTeaser($filterSettings);
$processedData['teaser']['forceHotelUid'] = $hotelUid;
}