diff --git a/src/Controller/Admin/LogController.php b/src/Controller/Admin/LogController.php index c17dded..161f49d 100644 --- a/src/Controller/Admin/LogController.php +++ b/src/Controller/Admin/LogController.php @@ -9,11 +9,8 @@ class LogController extends AdminAbstractController { - protected LogManagerInterface $logManager; - - public function __construct(LogManagerInterface $logManager) + public function __construct(protected LogManagerInterface $logManager) { - $this->logManager = $logManager; } public function loadLogsForConnectorAction(Request $request, int $connectorEngineId): JsonResponse diff --git a/src/Controller/Admin/SettingsController.php b/src/Controller/Admin/SettingsController.php index 932f6b9..adcb2b3 100644 --- a/src/Controller/Admin/SettingsController.php +++ b/src/Controller/Admin/SettingsController.php @@ -16,28 +16,14 @@ class SettingsController extends AdminAbstractController { - protected FormFactoryInterface $formFactory; - protected EnvironmentServiceInterface $environmentService; - protected ConnectorManagerInterface $connectorManager; - protected ConnectorDefinitionRegistryInterface $connectorRegistry; - protected ConnectorServiceInterface $connectorService; - protected ExtJsDataBuilder $extJsDataBuilder; - public function __construct( - - FormFactoryInterface $formFactory, - EnvironmentServiceInterface $environmentService, - ConnectorManagerInterface $connectorManager, - ConnectorDefinitionRegistryInterface $connectorRegistry, - ConnectorServiceInterface $connectorService, - ExtJsDataBuilder $extJsDataBuilder + protected FormFactoryInterface $formFactory, + protected EnvironmentServiceInterface $environmentService, + protected ConnectorManagerInterface $connectorManager, + protected ConnectorDefinitionRegistryInterface $connectorRegistry, + protected ConnectorServiceInterface $connectorService, + protected ExtJsDataBuilder $extJsDataBuilder ) { - $this->formFactory = $formFactory; - $this->environmentService = $environmentService; - $this->connectorManager = $connectorManager; - $this->connectorRegistry = $connectorRegistry; - $this->connectorService = $connectorService; - $this->extJsDataBuilder = $extJsDataBuilder; } /** diff --git a/src/Controller/Admin/WallsController.php b/src/Controller/Admin/WallsController.php index e5ae1a1..5627a3b 100644 --- a/src/Controller/Admin/WallsController.php +++ b/src/Controller/Admin/WallsController.php @@ -17,24 +17,13 @@ class WallsController extends AdminAbstractController { - protected LockServiceInterface $lockService; - protected LoggerInterface $logger; - protected FormFactoryInterface $formFactory; - protected WallManagerInterface $wallManager; - protected ExtJsDataBuilder $extJsDataBuilder; - public function __construct( - LockServiceInterface $lockService, - LoggerInterface $logger, - FormFactoryInterface $formFactory, - WallManagerInterface $wallManager, - ExtJsDataBuilder $extJsDataBuilder + protected LockServiceInterface $lockService, + protected LoggerInterface $logger, + protected FormFactoryInterface $formFactory, + protected WallManagerInterface $wallManager, + protected ExtJsDataBuilder $extJsDataBuilder ) { - $this->lockService = $lockService; - $this->logger = $logger; - $this->formFactory = $formFactory; - $this->wallManager = $wallManager; - $this->extJsDataBuilder = $extJsDataBuilder; } public function fetchAllWallsAction(): JsonResponse diff --git a/src/Dto/AbstractData.php b/src/Dto/AbstractData.php index a1698c0..eb16459 100644 --- a/src/Dto/AbstractData.php +++ b/src/Dto/AbstractData.php @@ -4,14 +4,12 @@ abstract class AbstractData { - protected BuildConfig $buildConfig; - protected array $options; protected mixed $transferredData = null; - public function __construct(BuildConfig $buildConfig, array $options) - { - $this->buildConfig = $buildConfig; - $this->options = $options; + public function __construct( + protected BuildConfig $buildConfig, + protected array $options + ) { } /** diff --git a/src/Dto/BuildConfig.php b/src/Dto/BuildConfig.php index be68fae..5addd39 100644 --- a/src/Dto/BuildConfig.php +++ b/src/Dto/BuildConfig.php @@ -9,18 +9,11 @@ class BuildConfig { - protected FeedInterface $feed; - protected ConnectorEngineConfigurationInterface $engineConfiguration; - protected array $definitionConfiguration; - public function __construct( - FeedInterface $feed, - ConnectorEngineConfigurationInterface $engineConfiguration, - array $definitionConfiguration + protected FeedInterface $feed, + protected ConnectorEngineConfigurationInterface $engineConfiguration, + protected array $definitionConfiguration ) { - $this->feed = $feed; - $this->engineConfiguration = $engineConfiguration; - $this->definitionConfiguration = $definitionConfiguration; } public function getEngineConfiguration(): ConnectorEngineConfigurationInterface diff --git a/src/Event/SocialPostBuildEvent.php b/src/Event/SocialPostBuildEvent.php index 234c8ef..6ecfc49 100644 --- a/src/Event/SocialPostBuildEvent.php +++ b/src/Event/SocialPostBuildEvent.php @@ -7,13 +7,10 @@ class SocialPostBuildEvent extends Event { - protected string $connectorName; - protected AbstractData $data; - - public function __construct(string $connectorName, AbstractData $data) - { - $this->connectorName = $connectorName; - $this->data = $data; + public function __construct( + protected string $connectorName, + protected AbstractData $data + ) { } public function getConnectorName(): string diff --git a/src/EventListener/FeedPostListener.php b/src/EventListener/FeedPostListener.php index 1f5e613..eb3b302 100644 --- a/src/EventListener/FeedPostListener.php +++ b/src/EventListener/FeedPostListener.php @@ -11,11 +11,8 @@ class FeedPostListener implements EventSubscriberInterface { - protected FeedPostManager $feedPostManager; - - public function __construct(FeedPostManager $feedPostManager) + public function __construct(protected FeedPostManager $feedPostManager) { - $this->feedPostManager = $feedPostManager; } public static function getSubscribedEvents(): array diff --git a/src/EventListener/Maintenance/CleanUpLogsTask.php b/src/EventListener/Maintenance/CleanUpLogsTask.php index 5990cf3..2c8ee42 100644 --- a/src/EventListener/Maintenance/CleanUpLogsTask.php +++ b/src/EventListener/Maintenance/CleanUpLogsTask.php @@ -7,18 +7,11 @@ class CleanUpLogsTask implements TaskInterface { - protected bool $enabled; - protected int $expirationDays; - protected LogRepositoryInterface $logRepository; - public function __construct( - bool $enabled, - int $expirationDays, - LogRepositoryInterface $logRepository + protected bool $enabled, + protected int $expirationDays, + protected LogRepositoryInterface $logRepository ) { - $this->enabled = $enabled; - $this->expirationDays = $expirationDays; - $this->logRepository = $logRepository; } public function execute(): void diff --git a/src/EventListener/Maintenance/CleanUpOldSocialPostsTask.php b/src/EventListener/Maintenance/CleanUpOldSocialPostsTask.php index 99dbc9d..d0a6d68 100644 --- a/src/EventListener/Maintenance/CleanUpOldSocialPostsTask.php +++ b/src/EventListener/Maintenance/CleanUpOldSocialPostsTask.php @@ -10,24 +10,13 @@ class CleanUpOldSocialPostsTask implements TaskInterface { public const LOCK_ID = 'social_data_maintenance_task_cleanup_old_social_posts'; - protected bool $enabled; - protected bool $deletePoster; - protected int $expirationDays; - protected LockServiceInterface $lockService; - protected SocialPostRepositoryInterface $socialPostRepository; - public function __construct( - bool $enabled, - bool $deletePoster, - int $expirationDays, - LockServiceInterface $lockService, - SocialPostRepositoryInterface $socialPostRepository + protected bool $enabled, + protected bool $deletePoster, + protected int $expirationDays, + protected LockServiceInterface $lockService, + protected SocialPostRepositoryInterface $socialPostRepository ) { - $this->enabled = $enabled; - $this->deletePoster = $deletePoster; - $this->expirationDays = $expirationDays; - $this->lockService = $lockService; - $this->socialPostRepository = $socialPostRepository; } public function execute(): void diff --git a/src/EventListener/Maintenance/FetchSocialPostsTask.php b/src/EventListener/Maintenance/FetchSocialPostsTask.php index dd14d5f..5c8d260 100644 --- a/src/EventListener/Maintenance/FetchSocialPostsTask.php +++ b/src/EventListener/Maintenance/FetchSocialPostsTask.php @@ -10,21 +10,12 @@ class FetchSocialPostsTask implements TaskInterface { public const LOCK_ID = 'social_data_maintenance_task_fetch_social_posts'; - protected bool $enabled; - protected float $interval; - protected LockServiceInterface $lockService; - protected SocialPostBuilderProcessor $socialPostBuilderProcessor; - public function __construct( - bool $enabled, - float $interval, - LockServiceInterface $lockService, - SocialPostBuilderProcessor $socialPostBuilderProcessor + protected bool $enabled, + protected float $interval, + protected LockServiceInterface $lockService, + protected SocialPostBuilderProcessor $socialPostBuilderProcessor ) { - $this->enabled = $enabled; - $this->interval = $interval; - $this->lockService = $lockService; - $this->socialPostBuilderProcessor = $socialPostBuilderProcessor; } public function execute(): void diff --git a/src/Factory/SocialPostFactory.php b/src/Factory/SocialPostFactory.php index a830378..094070a 100644 --- a/src/Factory/SocialPostFactory.php +++ b/src/Factory/SocialPostFactory.php @@ -7,11 +7,8 @@ class SocialPostFactory implements SocialPostFactoryInterface { - protected EnvironmentService $environmentService; - - public function __construct(EnvironmentService $environmentService) + public function __construct(protected EnvironmentService $environmentService) { - $this->environmentService = $environmentService; } public function create(): SocialPostInterface @@ -20,4 +17,4 @@ public function create(): SocialPostInterface return new $objectClass(); } -} \ No newline at end of file +} diff --git a/src/Form/Admin/Type/TagType.php b/src/Form/Admin/Type/TagType.php index efbd367..b9b87b9 100644 --- a/src/Form/Admin/Type/TagType.php +++ b/src/Form/Admin/Type/TagType.php @@ -13,11 +13,8 @@ class TagType extends AbstractType { - protected EntityManagerInterface $manager; - - public function __construct(EntityManagerInterface $manager) + public function __construct(protected EntityManagerInterface $manager) { - $this->manager = $manager; } public function buildForm(FormBuilderInterface $builder, array $options): void @@ -62,4 +59,4 @@ public function configureOptions(OptionsResolver $resolver): void 'data_class' => Tag::class ]); } -} \ No newline at end of file +} diff --git a/src/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php b/src/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php index c177a2b..886f400 100644 --- a/src/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php +++ b/src/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php @@ -11,15 +11,10 @@ class ConnectorEngineChoiceType extends AbstractType { - protected ConnectorDefinitionRegistry $connectorDefinitionRegistry; - protected ConnectorManagerInterface $connectorManager; - public function __construct( - ConnectorDefinitionRegistry $connectorDefinitionRegistry, - ConnectorManagerInterface $connectorManager + protected ConnectorDefinitionRegistry $connectorDefinitionRegistry, + protected ConnectorManagerInterface $connectorManager ) { - $this->connectorDefinitionRegistry = $connectorDefinitionRegistry; - $this->connectorManager = $connectorManager; } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Form/Admin/Type/Wall/FeedType.php b/src/Form/Admin/Type/Wall/FeedType.php index ee3d7e0..acff698 100644 --- a/src/Form/Admin/Type/Wall/FeedType.php +++ b/src/Form/Admin/Type/Wall/FeedType.php @@ -23,15 +23,10 @@ class FeedType extends AbstractType { use ExtJsTagTransformTrait; - protected ConnectorManagerInterface $connectorManager; - protected EntityManagerInterface $entityManager; - public function __construct( - ConnectorManagerInterface $connectorManager, - EntityManagerInterface $entityManager + protected ConnectorManagerInterface $connectorManager, + protected EntityManagerInterface $entityManager ) { - $this->connectorManager = $connectorManager; - $this->entityManager = $entityManager; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/Admin/Type/Wall/WallType.php b/src/Form/Admin/Type/Wall/WallType.php index be71298..5f70354 100644 --- a/src/Form/Admin/Type/Wall/WallType.php +++ b/src/Form/Admin/Type/Wall/WallType.php @@ -18,11 +18,8 @@ class WallType extends AbstractType { use ExtJsTagTransformTrait; - protected EntityManagerInterface $entityManager; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php index 12f049c..773487e 100644 --- a/src/Logger/Logger.php +++ b/src/Logger/Logger.php @@ -4,11 +4,8 @@ class Logger implements LoggerInterface { - protected \Psr\Log\LoggerInterface $logger; - - public function __construct(\Psr\Log\LoggerInterface $logger) + public function __construct(protected \Psr\Log\LoggerInterface $logger) { - $this->logger = $logger; } public function log(string $level, $message, ?array $context = null): void diff --git a/src/Manager/ConnectorManager.php b/src/Manager/ConnectorManager.php index a37da95..23597aa 100644 --- a/src/Manager/ConnectorManager.php +++ b/src/Manager/ConnectorManager.php @@ -11,21 +11,12 @@ class ConnectorManager implements ConnectorManagerInterface { - protected array $availableConnectors; - protected ConnectorDefinitionRegistryInterface $connectorDefinitionRegistry; - protected ConnectorEngineRepositoryInterface $connectorEngineRepository; - protected EntityManagerInterface $entityManager; - public function __construct( - array $availableConnectors, - ConnectorDefinitionRegistryInterface $connectorDefinitionRegistry, - ConnectorEngineRepositoryInterface $connectorEngineRepository, - EntityManagerInterface $entityManager + protected array $availableConnectors, + protected ConnectorDefinitionRegistryInterface $connectorDefinitionRegistry, + protected ConnectorEngineRepositoryInterface $connectorEngineRepository, + protected EntityManagerInterface $entityManager ) { - $this->availableConnectors = $availableConnectors; - $this->connectorDefinitionRegistry = $connectorDefinitionRegistry; - $this->connectorEngineRepository = $connectorEngineRepository; - $this->entityManager = $entityManager; } public function getAllActiveConnectorDefinitions(): array diff --git a/src/Manager/FeedPostManager.php b/src/Manager/FeedPostManager.php index f7d03a6..b8961d3 100644 --- a/src/Manager/FeedPostManager.php +++ b/src/Manager/FeedPostManager.php @@ -3,7 +3,6 @@ namespace SocialDataBundle\Manager; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Query\QueryBuilder; use Pimcore\Model\DataObject\Concrete; use SocialDataBundle\Model\FeedInterface; @@ -11,11 +10,8 @@ class FeedPostManager implements FeedPostManagerInterface { - protected EntityManagerInterface $entityManager; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; } public function connectFeedWithPost(FeedInterface $feed, Concrete $socialPost): void @@ -48,8 +44,7 @@ protected function relationExists(FeedInterface $feed, Concrete $socialPost): bo 'postId' => $socialPost->getId() ]); - /** @var Statement $stmt */ - $stmt = $qb->execute(); + $stmt = $qb->executeQuery(); return $stmt->rowCount() > 0; } diff --git a/src/Manager/LogManager.php b/src/Manager/LogManager.php index c37fa78..38e24a5 100644 --- a/src/Manager/LogManager.php +++ b/src/Manager/LogManager.php @@ -13,18 +13,11 @@ class LogManager implements LogManagerInterface { - protected LogRepositoryInterface $logRepository; - protected ConnectorManagerInterface $connectorManager; - protected EntityManagerInterface $entityManager; - public function __construct( - LogRepositoryInterface $logRepository, - ConnectorManagerInterface $connectorManager, - EntityManagerInterface $entityManager + protected LogRepositoryInterface $logRepository, + protected ConnectorManagerInterface $connectorManager, + protected EntityManagerInterface $entityManager ) { - $this->logRepository = $logRepository; - $this->connectorManager = $connectorManager; - $this->entityManager = $entityManager; } public function getForConnectorEngine(int $connectorEngineId): Paginator diff --git a/src/Manager/SocialPostManager.php b/src/Manager/SocialPostManager.php index 10355a5..647260a 100644 --- a/src/Manager/SocialPostManager.php +++ b/src/Manager/SocialPostManager.php @@ -16,21 +16,12 @@ class SocialPostManager implements SocialPostManagerInterface { - protected LoggerInterface $logger; - protected FeedPostManagerInterface $feedPostManager; - protected SocialPostRepositoryInterface $socialPostRepository; - protected SocialPostFactoryInterface $socialPostFactory; - public function __construct( - LoggerInterface $logger, - FeedPostManagerInterface $feedPostManager, - SocialPostRepositoryInterface $socialPostRepository, - SocialPostFactoryInterface $socialPostFactory + protected LoggerInterface $logger, + protected FeedPostManagerInterface $feedPostManager, + protected SocialPostRepositoryInterface $socialPostRepository, + protected SocialPostFactoryInterface $socialPostFactory ) { - $this->logger = $logger; - $this->feedPostManager = $feedPostManager; - $this->socialPostRepository = $socialPostRepository; - $this->socialPostFactory = $socialPostFactory; } public function checkWallStoragePaths(WallInterface $wall): void diff --git a/src/Manager/WallManager.php b/src/Manager/WallManager.php index a44e4a2..c51701a 100644 --- a/src/Manager/WallManager.php +++ b/src/Manager/WallManager.php @@ -10,15 +10,10 @@ class WallManager implements WallManagerInterface { - protected WallRepositoryInterface $wallRepository; - protected EntityManagerInterface $entityManager; - public function __construct( - WallRepositoryInterface $wallRepository, - EntityManagerInterface $entityManager + protected WallRepositoryInterface $wallRepository, + protected EntityManagerInterface $entityManager ) { - $this->wallRepository = $wallRepository; - $this->entityManager = $entityManager; } public function getAll(): array diff --git a/src/Processor/SocialPostBuilderProcessor.php b/src/Processor/SocialPostBuilderProcessor.php index 3d063d5..fd572a1 100644 --- a/src/Processor/SocialPostBuilderProcessor.php +++ b/src/Processor/SocialPostBuilderProcessor.php @@ -28,27 +28,14 @@ class SocialPostBuilderProcessor { - protected LoggerInterface $logger; - protected LockServiceInterface $lockService; - protected EventDispatcherInterface $eventDispatcher; - protected WallManagerInterface $wallManager; - protected SocialPostManagerInterface $socialPostManager; - protected ConnectorManagerInterface $connectorManager; - public function __construct( - LoggerInterface $logger, - LockServiceInterface $lockService, - EventDispatcherInterface $eventDispatcher, - WallManagerInterface $wallManager, - SocialPostManagerInterface $socialPostManager, - ConnectorManagerInterface $connectorManager + protected LoggerInterface $logger, + protected LockServiceInterface $lockService, + protected EventDispatcherInterface $eventDispatcher, + protected WallManagerInterface $wallManager, + protected SocialPostManagerInterface $socialPostManager, + protected ConnectorManagerInterface $connectorManager ) { - $this->logger = $logger; - $this->lockService = $lockService; - $this->eventDispatcher = $eventDispatcher; - $this->wallManager = $wallManager; - $this->socialPostManager = $socialPostManager; - $this->connectorManager = $connectorManager; } public function process(bool $forceProcessing, ?int $wallId): void diff --git a/src/Repository/LogRepository.php b/src/Repository/LogRepository.php index 1456298..c65a9de 100644 --- a/src/Repository/LogRepository.php +++ b/src/Repository/LogRepository.php @@ -3,7 +3,7 @@ namespace SocialDataBundle\Repository; use Carbon\Carbon; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Tools\Pagination\Paginator; @@ -49,7 +49,7 @@ public function deleteExpired(int $expireDays): void $query = $qb->delete() ->where('l.creationDate < :expires') - ->setParameter('expires', $expireDate->toDateTime(), Type::DATETIME) + ->setParameter('expires', $expireDate->toDateTime(), Types::DATETIME_MUTABLE) ->getQuery(); $query->execute(); diff --git a/src/Repository/SocialPostRepository.php b/src/Repository/SocialPostRepository.php index 6b35f66..2de7584 100644 --- a/src/Repository/SocialPostRepository.php +++ b/src/Repository/SocialPostRepository.php @@ -12,11 +12,8 @@ class SocialPostRepository implements SocialPostRepositoryInterface { - protected EnvironmentService $environmentService; - - public function __construct(EnvironmentService $environmentService) + public function __construct(protected EnvironmentService $environmentService) { - $this->environmentService = $environmentService; } public function findOneByIdAndSocialType(string $socialPostId, string $socialPostType, bool $unpublished = false): ?SocialPostInterface diff --git a/src/Service/EnvironmentService.php b/src/Service/EnvironmentService.php index 693f269..84d10cb 100644 --- a/src/Service/EnvironmentService.php +++ b/src/Service/EnvironmentService.php @@ -4,11 +4,8 @@ class EnvironmentService implements EnvironmentServiceInterface { - protected string $socialPostDataClass; - - public function __construct(string $socialPostDataClass) + public function __construct(protected string $socialPostDataClass) { - $this->socialPostDataClass = $socialPostDataClass; } public function getSocialPostDataClass(): string diff --git a/src/Service/StatisticService.php b/src/Service/StatisticService.php index bd71446..e59ce40 100644 --- a/src/Service/StatisticService.php +++ b/src/Service/StatisticService.php @@ -8,11 +8,8 @@ class StatisticService implements StatisticServiceInterface { - protected SocialPostRepositoryInterface $socialPostRepository; - - public function __construct(SocialPostRepositoryInterface $socialPostRepository) + public function __construct(protected SocialPostRepositoryInterface $socialPostRepository) { - $this->socialPostRepository = $socialPostRepository; } public function getWallStatistics(WallInterface $wall): array