Migrate to constructor promoted properties

This commit is contained in:
Yassine Guedidi
2025-04-05 13:54:27 +02:00
parent 4168727f36
commit 1d5674a230
85 changed files with 441 additions and 854 deletions

View File

@ -14,18 +14,13 @@ use Wallabag\Repository\UserRepository;
abstract class AbstractConsumer
{
protected $em;
protected $userRepository;
protected $import;
protected $eventDispatcher;
protected $logger;
public function __construct(EntityManagerInterface $em, UserRepository $userRepository, AbstractImport $import, EventDispatcherInterface $eventDispatcher, ?LoggerInterface $logger = null)
{
$this->em = $em;
$this->userRepository = $userRepository;
$this->import = $import;
$this->eventDispatcher = $eventDispatcher;
public function __construct(
protected EntityManagerInterface $em,
protected UserRepository $userRepository,
protected AbstractImport $import,
protected EventDispatcherInterface $eventDispatcher,
protected ?LoggerInterface $logger = null,
) {
$this->logger = $logger ?: new NullLogger();
}
@ -74,9 +69,7 @@ abstract class AbstractConsumer
// entry saved, dispatch event about it!
$this->eventDispatcher->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
// clear only affected entities
$this->em->clear(Entry::class);
$this->em->clear(Tag::class);
$this->em->clear();
} catch (\Exception $e) {
$this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]);

View File

@ -10,48 +10,21 @@ use OldSound\RabbitMqBundle\RabbitMq\Consumer;
*/
class RabbitMQConsumerTotalProxy
{
private Consumer $pocketConsumer;
private Consumer $readabilityConsumer;
private Consumer $wallabagV1Consumer;
private Consumer $wallabagV2Consumer;
private Consumer $firefoxConsumer;
private Consumer $chromeConsumer;
private Consumer $instapaperConsumer;
private Consumer $pinboardConsumer;
private Consumer $deliciousConsumer;
private Consumer $elcuratorConsumer;
private Consumer $shaarliConsumer;
private Consumer $pocketHtmlConsumer;
private Consumer $omnivoreConsumer;
public function __construct(
Consumer $pocketConsumer,
Consumer $readabilityConsumer,
Consumer $wallabagV1Consumer,
Consumer $wallabagV2Consumer,
Consumer $firefoxConsumer,
Consumer $chromeConsumer,
Consumer $instapaperConsumer,
Consumer $pinboardConsumer,
Consumer $deliciousConsumer,
Consumer $elcuratorConsumer,
Consumer $shaarliConsumer,
Consumer $pocketHtmlConsumer,
Consumer $omnivoreConsumer,
private Consumer $pocketConsumer,
private Consumer $readabilityConsumer,
private Consumer $wallabagV1Consumer,
private Consumer $wallabagV2Consumer,
private Consumer $firefoxConsumer,
private Consumer $chromeConsumer,
private Consumer $instapaperConsumer,
private Consumer $pinboardConsumer,
private Consumer $deliciousConsumer,
private Consumer $elcuratorConsumer,
private Consumer $shaarliConsumer,
private Consumer $pocketHtmlConsumer,
private Consumer $omnivoreConsumer,
) {
$this->pocketConsumer = $pocketConsumer;
$this->readabilityConsumer = $readabilityConsumer;
$this->wallabagV1Consumer = $wallabagV1Consumer;
$this->wallabagV2Consumer = $wallabagV2Consumer;
$this->firefoxConsumer = $firefoxConsumer;
$this->chromeConsumer = $chromeConsumer;
$this->instapaperConsumer = $instapaperConsumer;
$this->pinboardConsumer = $pinboardConsumer;
$this->deliciousConsumer = $deliciousConsumer;
$this->elcuratorConsumer = $elcuratorConsumer;
$this->shaarliConsumer = $shaarliConsumer;
$this->pocketHtmlConsumer = $pocketHtmlConsumer;
$this->omnivoreConsumer = $omnivoreConsumer;
}
/**