You are here

abstract class ParentEntityReactionBase in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 src/Storage/ParentEntityReactionBase.php \Drupal\entity_hierarchy\Storage\ParentEntityReactionBase

Defines a base class for reacting to parent entity updates.

Hierarchy

Expanded class hierarchy of ParentEntityReactionBase

File

src/Storage/ParentEntityReactionBase.php, line 12

Namespace

Drupal\entity_hierarchy\Storage
View source
abstract class ParentEntityReactionBase implements ContainerInjectionInterface {
  use TreeLockTrait;

  /**
   * Nested set storage.
   *
   * @var \Drupal\entity_hierarchy\Storage\NestedSetStorageFactory
   */
  protected $nestedSetStorageFactory;

  /**
   * Node key factory.
   *
   * @var \Drupal\entity_hierarchy\Storage\NestedSetNodeKeyFactory
   */
  protected $nodeKeyFactory;

  /**
   * Parent candidate interface.
   *
   * @var \Drupal\entity_hierarchy\Information\ParentCandidateInterface
   */
  protected $parentCandidate;

  /**
   * Constructs a new ParentEntityRevisionUpdater object.
   *
   * @param \Drupal\entity_hierarchy\Storage\NestedSetStorageFactory $nestedSetStorageFactory
   *   Nested set storage factory.
   * @param \Drupal\entity_hierarchy\Storage\NestedSetNodeKeyFactory $nodeKeyFactory
   *   Node key factory.
   * @param \Drupal\entity_hierarchy\Information\ParentCandidateInterface $parentCandidate
   *   Parent candidate service.
   */
  public function __construct(NestedSetStorageFactory $nestedSetStorageFactory, NestedSetNodeKeyFactory $nodeKeyFactory, ParentCandidateInterface $parentCandidate) {
    $this->nestedSetStorageFactory = $nestedSetStorageFactory;
    $this->nodeKeyFactory = $nodeKeyFactory;
    $this->parentCandidate = $parentCandidate;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return (new static($container
      ->get('entity_hierarchy.nested_set_storage_factory'), $container
      ->get('entity_hierarchy.nested_set_node_factory'), $container
      ->get('entity_hierarchy.information.parent_candidate')))
      ->setLockBackend($container
      ->get('lock'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParentEntityReactionBase::$nestedSetStorageFactory protected property Nested set storage.
ParentEntityReactionBase::$nodeKeyFactory protected property Node key factory.
ParentEntityReactionBase::$parentCandidate protected property Parent candidate interface.
ParentEntityReactionBase::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create 1
ParentEntityReactionBase::__construct public function Constructs a new ParentEntityRevisionUpdater object. 1
TreeLockTrait::$lockBackend protected property Lock backend.
TreeLockTrait::getLockName protected function Gets lock name.
TreeLockTrait::lockBackend protected function Gets lock backend.
TreeLockTrait::lockTree protected function Locks tree.
TreeLockTrait::releaseLock protected function Releases lock.
TreeLockTrait::setLockBackend public function Sets lock backend.