You are here

class FeedsQueueExecutable in Feeds 8.3

Import feeds using the queue API.

Hierarchy

Expanded class hierarchy of FeedsQueueExecutable

2 files declare their use of FeedsQueueExecutable
FeedRefresh.php in src/Plugin/QueueWorker/FeedRefresh.php
FeedRefreshTest.php in tests/src/Unit/Plugin/QueueWorker/FeedRefreshTest.php

File

src/FeedsQueueExecutable.php, line 16

Namespace

Drupal\feeds
View source
class FeedsQueueExecutable extends FeedsExecutable {

  /**
   * The queue factory.
   *
   * @var \Drupal\Core\Queue\QueueFactory
   */
  protected $queueFactory;

  /**
   * Constructs a new FeedsQueueExecutable object.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
   *   The event dispatcher.
   * @param \Drupal\Core\Session\AccountSwitcherInterface $account_switcher
   *   The account switcher.
   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
   *   The messenger service.
   * @param \Drupal\Core\Queue\QueueFactory $queue_factory
   *   The queue factory.
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager, EventDispatcherInterface $event_dispatcher, AccountSwitcherInterface $account_switcher, MessengerInterface $messenger, QueueFactory $queue_factory) {
    parent::__construct($entity_type_manager, $event_dispatcher, $account_switcher, $messenger);
    $this->queueFactory = $queue_factory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('entity_type.manager'), $container
      ->get('event_dispatcher'), $container
      ->get('account_switcher'), $container
      ->get('messenger'), $container
      ->get('queue'));
  }

  /**
   * {@inheritdoc}
   */
  protected function createBatch(FeedInterface $feed, $stage) {
    return new FeedsQueueBatch($this, $feed, $stage, $this->queueFactory);
  }

  /**
   * {@inheritdoc}
   */
  protected function handleException(FeedInterface $feed, $stage, array $params, Exception $exception) {
    $feed
      ->finishImport();
    if ($exception instanceof EmptyFeedException) {
      return;
    }
    throw $exception;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
EventDispatcherTrait::$_eventDispatcher private property The event dispatcher service.
EventDispatcherTrait::dispatchEvent protected function Dispatches an event.
EventDispatcherTrait::getEventDispatcher protected function Returns the event dispatcher service.
EventDispatcherTrait::setEventDispatcher public function Sets the event dispatcher service to use.
FeedsExecutable::$accountSwitcher protected property The account switcher.
FeedsExecutable::$entityTypeManager protected property The entity type manager.
FeedsExecutable::$messenger protected property The messenger service.
FeedsExecutable::doClean protected function Cleans an entity.
FeedsExecutable::doFetch protected function Invokes the fetch stage.
FeedsExecutable::doParse protected function Parses.
FeedsExecutable::doProcess protected function Processes an item.
FeedsExecutable::finish protected function Finalizes the import. 1
FeedsExecutable::import protected function Begin an import.
FeedsExecutable::processItem public function Processes a stage of an import. Overrides FeedsExecutableInterface::processItem
FeedsExecutable::switchAccount protected function Safely switches to another account.
FeedsExecutableInterface::BEGIN constant Parameter passed when starting a new import.
FeedsExecutableInterface::CLEAN constant Parameter passed when cleaning.
FeedsExecutableInterface::FETCH constant Parameter passed when fetching.
FeedsExecutableInterface::FINISH constant Parameter passed when finishing.
FeedsExecutableInterface::PARSE constant Parameter passed when parsing.
FeedsExecutableInterface::PROCESS constant Parameter passed when processing.
FeedsQueueExecutable::$queueFactory protected property The queue factory.
FeedsQueueExecutable::create public static function Instantiates a new instance of this class. Overrides FeedsExecutable::create
FeedsQueueExecutable::createBatch protected function Creates a new batch object. Overrides FeedsExecutable::createBatch
FeedsQueueExecutable::handleException protected function Handles an exception during importing. Overrides FeedsExecutable::handleException
FeedsQueueExecutable::__construct public function Constructs a new FeedsQueueExecutable object. Overrides FeedsExecutable::__construct
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.