You are here

public function PushQueue::__construct in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 modules/salesforce_push/src/PushQueue.php \Drupal\salesforce_push\PushQueue::__construct()
  2. 5.0.x modules/salesforce_push/src/PushQueue.php \Drupal\salesforce_push\PushQueue::__construct()

PushQueue constructor.

Parameters

\Drupal\Core\Database\Connection $connection: Database service.

\Drupal\Core\State\StateInterface $state: State service.

\Drupal\salesforce_push\PushQueueProcessorPluginManager $queue_manager: Queue plugin manager service.

\Drupal\Core\Entity\EntityTypeManagerInterface $etm: ETM service.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: Event dispatcher service.

\Drupal\Component\Datetime\TimeInterface $time: Time service.

\Drupal\Core\Config\ConfigFactoryInterface $config: Config service.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

Overrides DatabaseQueue::__construct

File

modules/salesforce_push/src/PushQueue.php, line 160

Class

PushQueue
Salesforce push queue.

Namespace

Drupal\salesforce_push

Code

public function __construct(Connection $connection, StateInterface $state, PushQueueProcessorPluginManager $queue_manager, EntityTypeManagerInterface $etm, EventDispatcherInterface $event_dispatcher, TimeInterface $time, ConfigFactoryInterface $config) {
  $this->connection = $connection;
  $this->state = $state;
  $this->queueManager = $queue_manager;
  $this->etm = $etm;
  $this->mappingStorage = $etm
    ->getStorage('salesforce_mapping');
  $this->mappedObjectStorage = $etm
    ->getStorage('salesforce_mapped_object');
  $this->eventDispatcher = $event_dispatcher;
  $this->time = $time;
  $this->config = $config
    ->get('salesforce.settings');
  $this->globalLimit = $this->config
    ->get('global_push_limit') ?: static::DEFAULT_GLOBAL_LIMIT;
  if (empty($this->globalLimit)) {
    $this->globalLimit = static::DEFAULT_GLOBAL_LIMIT;
  }
  $this->maxFails = $state
    ->get('salesforce.push_queue_max_fails', static::DEFAULT_MAX_FAILS);
  if (empty($this->maxFails)) {
    $this->maxFails = static::DEFAULT_MAX_FAILS;
  }
  $this->garbageCollected = FALSE;
}