Use loggeraware trait

This commit is contained in:
Björn Fromme
2020-02-06 17:05:23 +01:00
parent 38cc4a6cda
commit 948d88c942
2 changed files with 8 additions and 16 deletions
@@ -30,13 +30,15 @@ namespace EP\EpProducts\Service;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use EP\EpProducts\Domain\Model\Contingent; use EP\EpProducts\Domain\Model\Contingent;
use EP\EpProducts\Traits\DbConnectionTrait; use EP\EpProducts\Traits\DbConnectionTrait;
use TYPO3\CMS\Core\Log\Logger; use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
class ContingentImportService implements SingletonInterface class ContingentImportService implements SingletonInterface, LoggerAwareInterface
{ {
use LoggerAwareTrait;
use DbConnectionTrait; use DbConnectionTrait;
const ROOMCODE_STATUS = 'BelKal'; const ROOMCODE_STATUS = 'BelKal';
@@ -56,11 +58,6 @@ class ContingentImportService implements SingletonInterface
*/ */
protected $db; protected $db;
/**
* @var Logger
*/
protected $logger;
/** /**
* @param ConfigurationManagerInterface $manager * @param ConfigurationManagerInterface $manager
* @throws \Doctrine\DBAL\DBALException * @throws \Doctrine\DBAL\DBALException
@@ -77,7 +74,6 @@ class ContingentImportService implements SingletonInterface
$this->pid = $settings['module']['tx_epproducts']['persistence']['storagePid']; $this->pid = $settings['module']['tx_epproducts']['persistence']['storagePid'];
} }
$this->db = $this->getDbConnection(); $this->db = $this->getDbConnection();
$this->logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
} }
/** /**
@@ -30,14 +30,16 @@ namespace EP\EpProducts\Service;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use EP\EpProducts\Domain\Model\Room; use EP\EpProducts\Domain\Model\Room;
use EP\EpProducts\Traits\DbConnectionTrait; use EP\EpProducts\Traits\DbConnectionTrait;
use TYPO3\CMS\Core\Log\Logger; use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Service\CacheService; use TYPO3\CMS\Extbase\Service\CacheService;
class DateImportService implements SingletonInterface class DateImportService implements SingletonInterface, LoggerAwareInterface
{ {
use LoggerAwareTrait;
use DbConnectionTrait; use DbConnectionTrait;
const CODE_PSEUDOPRICE = 'PDGS'; const CODE_PSEUDOPRICE = 'PDGS';
@@ -78,11 +80,6 @@ class DateImportService implements SingletonInterface
*/ */
protected $db; protected $db;
/**
* @var Logger
*/
protected $logger;
/** /**
* @var CacheService * @var CacheService
*/ */
@@ -123,7 +120,6 @@ class DateImportService implements SingletonInterface
public function import($path) public function import($path)
{ {
$this->db = $this->getDbConnection(); $this->db = $this->getDbConnection();
$this->logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
$this->getRoomMappings(); $this->getRoomMappings();
$this->getHotelMappings(); $this->getHotelMappings();
$this->importPickups(); $this->importPickups();