You are here

WorkflowStorage.php in Workflow 8

File

src/Entity/WorkflowStorage.php
View source
<?php

namespace Drupal\workflow\Entity;

use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\State\StateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Storage handler for workflow config entities.
 */
class WorkflowStorage extends ConfigEntityStorage {

  /**
   * The state service.
   *
   * @var \Drupal\Core\State\StateInterface
   */
  protected $stateService;

  /**
   * Constructs a WorkflowStorage object.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type definition.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory service.
   * @param \Drupal\Component\Uuid\UuidInterface $uuid_service
   *   The UUID service.
   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
   *   The language manager.
   * @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache
   *   The memory cache backend.
   * @param \Drupal\Core\State\StateInterface $state_service
   *   The state service.
   */
  public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, StateInterface $state_service) {
    parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager, $memory_cache);
    $this->stateService = $state_service;
  }

  /**
   * {@inheritdoc}
   */
  public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
    return new static($entity_type, $container
      ->get('config.factory'), $container
      ->get('uuid'), $container
      ->get('language_manager'), $container
      ->get('entity.memory_cache'), $container
      ->get('state'));
  }

  /**
   * Returns a list of event names that are used by active workflows.
   *
   * @return string[]
   *   The list of event names keyed by event name.
   */
  protected function getRegisteredEvents() {

    //    $events = [];
    //    foreach ($this->loadMultiple() as $rules_config) {
    //      $event = $rules_config->getEvent();
    //      if ($event && !isset($events[$event])) {
    //        $events[$event] = $event;
    //      }
    //    }
    //    return $events;
  }

}

Classes

Namesort descending Description
WorkflowStorage Storage handler for workflow config entities.