You are here

class CleanUpStubsEvent in Acquia Content Hub 8.2

Event to clean up stubs after import.

@package Drupal\acquia_contenthub\Event

Hierarchy

  • class \Drupal\acquia_contenthub\Event\CleanUpStubsEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of CleanUpStubsEvent

5 files declare their use of CleanUpStubsEvent
ContentModerationStateStubCleanup.php in src/EventSubscriber/CleanupStubs/ContentModerationStateStubCleanup.php
DefaultStubCleanup.php in src/EventSubscriber/CleanupStubs/DefaultStubCleanup.php
LayoutBuilderInlineBlockStubCleanup.php in src/EventSubscriber/CleanupStubs/LayoutBuilderInlineBlockStubCleanup.php
LayoutBuilderInlineBlockStubCleanupTest.php in tests/src/Kernel/EventSubscriber/CleanUpStubs/LayoutBuilderInlineBlockStubCleanupTest.php
StubTracker.php in src/StubTracker.php

File

src/Event/CleanUpStubsEvent.php, line 14

Namespace

Drupal\acquia_contenthub\Event
View source
class CleanUpStubsEvent extends Event {

  /**
   * The entity.
   *
   * @var \Drupal\Core\Entity\EntityInterface|null
   */
  protected $entity;

  /**
   * The dependency stack.
   *
   * @var \Drupal\depcalc\DependencyStack
   */
  protected $stack;

  /**
   * By default, we do not delete the stubs.
   *
   * @var \Drupal\depcalc\DependencyStack
   * @see \Drupal\acquia_contenthub\EventSubscriber\CleanupStubs\DefaultStubCleanup
   */
  protected $delete = FALSE;

  /**
   * CleanUpStubsEvent constructor.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity interface.
   * @param \Drupal\depcalc\DependencyStack $stack
   *   The dependency stack.
   */
  public function __construct(EntityInterface $entity, DependencyStack $stack) {
    $this->entity = $entity;
    $this->stack = $stack;
  }

  /**
   * Get the entity interface.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   The entity interface for this event.
   */
  public function getEntity() : EntityInterface {
    return $this->entity;
  }

  /**
   * Get the dependency stack.
   *
   * @return \Drupal\depcalc\DependencyStack
   *   The dependency stack for this event.
   */
  public function getStack() : DependencyStack {
    return $this->stack;
  }

  /**
   * Set the stub to be deleted.
   */
  public function deleteStub() {
    $this->delete = TRUE;
  }

  /**
   * Get the delete status.
   *
   * @return bool
   *   Delete status for this event.
   *
   * @see \Drupal\acquia_contenthub\StubTracker::cleanUp
   */
  public function doDeleteStub() : bool {
    return $this->delete;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CleanUpStubsEvent::$delete protected property By default, we do not delete the stubs.
CleanUpStubsEvent::$entity protected property The entity.
CleanUpStubsEvent::$stack protected property The dependency stack.
CleanUpStubsEvent::deleteStub public function Set the stub to be deleted.
CleanUpStubsEvent::doDeleteStub public function Get the delete status.
CleanUpStubsEvent::getEntity public function Get the entity interface.
CleanUpStubsEvent::getStack public function Get the dependency stack.
CleanUpStubsEvent::__construct public function CleanUpStubsEvent constructor.