You are here

abstract class EncryptedFieldUpdateBase in Field Encryption 8.2

Provides base functionality for the EncryptedFieldUpdate Queue Workers.

Hierarchy

Expanded class hierarchy of EncryptedFieldUpdateBase

1 file declares its use of EncryptedFieldUpdateBase
CronEncryptedFieldUpdate.php in src/Plugin/QueueWorker/CronEncryptedFieldUpdate.php

File

src/Plugin/QueueWorker/EncryptedFieldUpdateBase.php, line 14

Namespace

Drupal\field_encrypt\Plugin\QueueWorker
View source
abstract class EncryptedFieldUpdateBase extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * The service the process entities.
   *
   * @var \Drupal\field_encrypt\FieldEncryptProcessEntitiesInterface.
   */
  protected $processEntitiesService;

  /**
   * A configuration object.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   */
  protected $config;

  /**
   * Creates a new EncryptedFieldUpdate object.
   *
   * @param \Drupal\field_encrypt\FieldEncryptProcessEntitiesInterface $process_entities_service
   *   The service the process entities.
   * @param ConfigFactoryInterface $config_factory
   *   The configuration factory.
   */
  public function __construct(FieldEncryptProcessEntitiesInterface $process_entities_service, ConfigFactoryInterface $config_factory) {
    $this->processEntitiesService = $process_entities_service;
    $this->config = $config_factory
      ->get('field_encrypt.settings');
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($container
      ->get('field_encrypt.process_entities'), $container
      ->get('config.factory'));
  }

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {

    // @TODO: remove config, if batch_size setting is irrelevant.
    $this->processEntitiesService
      ->updateStoredField($data['field_name'], $data['entity_type'], $data['original_config'], $data['entity_id']);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EncryptedFieldUpdateBase::$config protected property A configuration object.
EncryptedFieldUpdateBase::$processEntitiesService protected property The service the process entities.
EncryptedFieldUpdateBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
EncryptedFieldUpdateBase::processItem public function Works on a single queue item. Overrides QueueWorkerInterface::processItem
EncryptedFieldUpdateBase::__construct public function Creates a new EncryptedFieldUpdate object. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.