class EntityShareCronPending in Entity Share Cron 8
Same name and namespace in other branches
- 8.2 src/Plugin/QueueWorker/EntityShareCronPending.php \Drupal\entity_share_cron\Plugin\QueueWorker\EntityShareCronPending
- 3.0.x src/Plugin/QueueWorker/EntityShareCronPending.php \Drupal\entity_share_cron\Plugin\QueueWorker\EntityShareCronPending
Imports entities from Entity Share channels.
Plugin annotation
@QueueWorker(
id = "entity_share_cron_pending",
title = @Translation("Entity Share Cron"),
cron = {"time" = 10}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\entity_share_cron\Plugin\QueueWorker\EntityShareCronPending implements ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of EntityShareCronPending
File
- src/
Plugin/ QueueWorker/ EntityShareCronPending.php, line 20
Namespace
Drupal\entity_share_cron\Plugin\QueueWorkerView source
class EntityShareCronPending extends QueueWorkerBase implements ContainerFactoryPluginInterface {
const PAGE_LIMIT = 5;
/**
* Entity Share Cron service.
*
* @var \Drupal\entity_share_cron\EntityShareCronServiceInterface
*/
protected $service;
/**
* Logger.
*
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* Constructor.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\entity_share_cron\EntityShareCronService $service
* Entity Share Cron service.
* @param \Psr\Log\LoggerInterface $logger
* Logger.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityShareCronService $service, LoggerInterface $logger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->service = $service;
$this->logger = $logger;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_share_cron'), $container
->get('logger.factory')
->get('entitiy_share_cron'));
}
/**
* {@inheritdoc}
*/
public function processItem($data) {
$remote_id = $data['remote_id'];
$channel_id = $data['channel_id'];
$channel_info = $data['channel_info'];
$this->logger
->info('Importing entities from channel %channel_id from remote %remote_id.', [
'%channel_id' => $channel_id,
'%remote_id' => $remote_id,
]);
$this->service
->sync($remote_id, $channel_id, $channel_info, self::PAGE_LIMIT);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityShareCronPending:: |
protected | property | Logger. | |
EntityShareCronPending:: |
protected | property | Entity Share Cron service. | |
EntityShareCronPending:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
EntityShareCronPending:: |
constant | |||
EntityShareCronPending:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
EntityShareCronPending:: |
public | function |
Constructor. Overrides PluginBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. |