forked from wallabag/wallabag
Migrate to constructor promoted properties
This commit is contained in:
@ -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]);
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user