class FeedsQueueBatch in Feeds 8.3
A batch task for the queue API.
Hierarchy
- class \Drupal\feeds\FeedsBatchBase implements FeedsBatchInterface
- class \Drupal\feeds\FeedsQueueBatch
Expanded class hierarchy of FeedsQueueBatch
File
- src/
FeedsQueueBatch.php, line 10
Namespace
Drupal\feedsView source
class FeedsQueueBatch extends FeedsBatchBase {
/**
* The queue factory.
*
* @var \Drupal\Core\Queue\QueueFactory
*/
protected $queueFactory;
/**
* Constructs a new FeedsQueueBatch object.
*
* @param \Drupal\feeds\FeedsExecutableInterface $executable
* The Feeds executable.
* @param \Drupal\feeds\FeedInterface $feed
* The feed to run a batch for.
* @param string $stage
* The stage of the batch to run.
* @param \Drupal\Core\Queue\QueueFactory $queue_factory
* The queue factory.
*/
public function __construct(FeedsExecutableInterface $executable, FeedInterface $feed, $stage, QueueFactory $queue_factory) {
parent::__construct($executable, $feed, $stage);
$this->queueFactory = $queue_factory;
}
/**
* {@inheritdoc}
*/
public function run() {
// Queue all operations now.
foreach ($this->operations as $operation) {
$this->queueFactory
->get('feeds_feed_refresh:' . $this->feed
->bundle())
->createItem([
$this->feed,
$operation['stage'],
$operation['params'],
]);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsBatchBase:: |
protected | property | The Feeds executable. | |
FeedsBatchBase:: |
protected | property | The feed to run a batch for. | |
FeedsBatchBase:: |
protected | property | A list of operations to run. | |
FeedsBatchBase:: |
protected | property | The stage of the batch to run. | |
FeedsBatchBase:: |
public | function |
Adds an operation. Overrides FeedsBatchInterface:: |
|
FeedsQueueBatch:: |
protected | property | The queue factory. | |
FeedsQueueBatch:: |
public | function |
Runs the batch. Overrides FeedsBatchInterface:: |
|
FeedsQueueBatch:: |
public | function |
Constructs a new FeedsQueueBatch object. Overrides FeedsBatchBase:: |