You are here

class FeedSubscriber in Feeds 8.3

Subscribes to feeds events.

Hierarchy

  • class \Drupal\feeds_test_multiple_cron_runs\EventSubscriber\FeedSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of FeedSubscriber

1 string reference to 'FeedSubscriber'
feeds_test_multiple_cron_runs.services.yml in tests/modules/feeds_test_multiple_cron_runs/feeds_test_multiple_cron_runs.services.yml
tests/modules/feeds_test_multiple_cron_runs/feeds_test_multiple_cron_runs.services.yml
1 service uses FeedSubscriber
feeds_test_multiple_cron_runs.feed_subscriber in tests/modules/feeds_test_multiple_cron_runs/feeds_test_multiple_cron_runs.services.yml
Drupal\feeds_test_multiple_cron_runs\EventSubscriber\FeedSubscriber

File

tests/modules/feeds_test_multiple_cron_runs/src/EventSubscriber/FeedSubscriber.php, line 12

Namespace

Drupal\feeds_test_multiple_cron_runs\EventSubscriber
View source
class FeedSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      FeedsEvents::PROCESS => [
        [
          'afterProcess',
          FeedsEvents::AFTER,
        ],
      ],
    ];
  }

  /**
   * Delays execution after limit is reached.
   */
  public function afterProcess(ProcessEvent $event) {
    static $processed = 0;
    $processed++;
    $limit = \Drupal::config('feeds_test_multiple_cron_runs.settings')
      ->get('import_queue_time');
    if ($processed == $limit) {
      sleep($limit);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedSubscriber::afterProcess public function Delays execution after limit is reached.
FeedSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.