You are here

class EntityUsageEvent in Entity Usage 8.2

Same name and namespace in other branches
  1. 8.4 src/Events/EntityUsageEvent.php \Drupal\entity_usage\Events\EntityUsageEvent
  2. 8 src/Events/EntityUsageEvent.php \Drupal\entity_usage\Events\EntityUsageEvent
  3. 8.3 src/Events/EntityUsageEvent.php \Drupal\entity_usage\Events\EntityUsageEvent

Implementation of Entity Usage events.

Hierarchy

  • class \Drupal\entity_usage\Events\EntityUsageEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of EntityUsageEvent

2 files declare their use of EntityUsageEvent
EntityUsage.php in src/EntityUsage.php
EntityUsageTest.php in tests/src/Kernel/EntityUsageTest.php

File

src/Events/EntityUsageEvent.php, line 10

Namespace

Drupal\entity_usage\Events
View source
class EntityUsageEvent extends Event {

  /**
   * The target entity ID.
   *
   * @var string
   */
  protected $targetEntityId;

  /**
   * The target entity type.
   *
   * @var string
   */
  protected $targetEntityType;

  /**
   * The source entity ID.
   *
   * @var string
   */
  protected $sourceEntityId;

  /**
   * The source entity type.
   *
   * @var string
   */
  protected $sourceEntityType;

  /**
   * The source entity language code.
   *
   * @var string
   */
  protected $sourceEntityLangcode;

  /**
   * The source entity revision ID.
   *
   * @var string
   */
  protected $sourceEntityRevisionId;

  /**
   * The method used to relate source entity with the target entity.
   *
   * @var string
   */
  protected $method;

  /**
   * The name of the field in the source entity using the target entity.
   *
   * @var string
   */
  protected $fieldName;

  /**
   * The number of references to add or remove.
   *
   * @var string
   */
  protected $count;

  /**
   * EntityUsageEvents constructor.
   *
   * @param int $target_id
   *   The target entity ID.
   * @param string $target_type
   *   The target entity type.
   * @param int $source_id
   *   The source entity ID.
   * @param string $source_type
   *   The source entity type.
   * @param string $source_langcode
   *   The source entity language code.
   * @param string $source_vid
   *   The source entity revision ID.
   * @param string $method
   *   The method or way the two entities are being referenced.
   * @param string $field_name
   *   The name of the field in the source entity using the target entity.
   * @param int $count
   *   The number of references to add or remove.
   */
  public function __construct($target_id = NULL, $target_type = NULL, $source_id = NULL, $source_type = NULL, $source_langcode = NULL, $source_vid = NULL, $method = NULL, $field_name = NULL, $count = NULL) {
    $this->targetEntityId = $target_id;
    $this->targetEntityType = $target_type;
    $this->sourceEntityId = $source_id;
    $this->sourceEntityType = $source_type;
    $this->sourceEntityLangcode = $source_langcode;
    $this->sourceEntityRevisionId = $source_vid;
    $this->method = $method;
    $this->fieldName = $field_name;
    $this->count = $count;
  }

  /**
   * Sets the target entity id.
   *
   * @param int $id
   *   The target entity id.
   */
  public function setTargetEntityId($id) {
    $this->targetEntityId = $id;
  }

  /**
   * Sets the target entity type.
   *
   * @param string $type
   *   The target entity type.
   */
  public function setTargetEntityType($type) {
    $this->targetEntityType = $type;
  }

  /**
   * Sets the source entity id.
   *
   * @param int $id
   *   The source entity id.
   */
  public function setSourceEntityId($id) {
    $this->sourceEntityId = $id;
  }

  /**
   * Sets the source entity type.
   *
   * @param string $type
   *   The source entity type.
   */
  public function setSourceEntityType($type) {
    $this->sourceEntityType = $type;
  }

  /**
   * Sets the source entity language code.
   *
   * @param string $langcode
   *   The source entity language code.
   */
  public function setSourceEntityLangcode($langcode) {
    $this->sourceEntityLangcode = $langcode;
  }

  /**
   * Sets the source entity revision ID.
   *
   * @param string $vid
   *   The source entity revision ID.
   */
  public function setSourceEntityRevisionId($vid) {
    $this->sourceEntityRevisionId = $vid;
  }

  /**
   * Sets the method used to relate source entity with the target entity.
   *
   * @param string $method
   *   The source method.
   */
  public function setMethod($method) {
    $this->method = $method;
  }

  /**
   * Sets the field name.
   *
   * @param string $field_name
   *   The field name.
   */
  public function setFieldName($field_name) {
    $this->fieldName = $field_name;
  }

  /**
   * Sets the count.
   *
   * @param int $count
   *   The number od references to add or remove.
   */
  public function setCount($count) {
    $this->count = $count;
  }

  /**
   * Gets the target entity id.
   *
   * @return null|string
   *   The target entity id or NULL.
   */
  public function getTargetEntityId() {
    return $this->targetEntityId;
  }

  /**
   * Gets the target entity type.
   *
   * @return null|string
   *   The target entity type or NULL.
   */
  public function getTargetEntityType() {
    return $this->targetEntityType;
  }

  /**
   * Gets the source entity id.
   *
   * @return null|int
   *   The source entity id or NULL.
   */
  public function getSourceEntityId() {
    return $this->sourceEntityId;
  }

  /**
   * Gets the source entity type.
   *
   * @return null|string
   *   The source entity type or NULL.
   */
  public function getSourceEntityType() {
    return $this->sourceEntityType;
  }

  /**
   * Gets the source entity language code.
   *
   * @return null|string
   *   The source entity language code or NULL.
   */
  public function getSourceEntityLangcode() {
    return $this->sourceEntityLangcode;
  }

  /**
   * Gets the source entity revision ID.
   *
   * @return null|string
   *   The source entity revision ID or NULL.
   */
  public function getSourceEntityRevisionId() {
    return $this->sourceEntityRevisionId;
  }

  /**
   * Gets the method used to relate source entity with the target entity.
   *
   * @return null|string
   *   The method or NULL.
   */
  public function getMethod() {
    return $this->method;
  }

  /**
   * Gets the field name.
   *
   * @return null|string
   *   The field name or NULL.
   */
  public function getFieldName() {
    return $this->fieldName;
  }

  /**
   * Gets the count.
   *
   * @return null|int
   *   The number of references to add or remove or NULL.
   */
  public function getCount() {
    return $this->count;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityUsageEvent::$count protected property The number of references to add or remove.
EntityUsageEvent::$fieldName protected property The name of the field in the source entity using the target entity.
EntityUsageEvent::$method protected property The method used to relate source entity with the target entity.
EntityUsageEvent::$sourceEntityId protected property The source entity ID.
EntityUsageEvent::$sourceEntityLangcode protected property The source entity language code.
EntityUsageEvent::$sourceEntityRevisionId protected property The source entity revision ID.
EntityUsageEvent::$sourceEntityType protected property The source entity type.
EntityUsageEvent::$targetEntityId protected property The target entity ID.
EntityUsageEvent::$targetEntityType protected property The target entity type.
EntityUsageEvent::getCount public function Gets the count.
EntityUsageEvent::getFieldName public function Gets the field name.
EntityUsageEvent::getMethod public function Gets the method used to relate source entity with the target entity.
EntityUsageEvent::getSourceEntityId public function Gets the source entity id.
EntityUsageEvent::getSourceEntityLangcode public function Gets the source entity language code.
EntityUsageEvent::getSourceEntityRevisionId public function Gets the source entity revision ID.
EntityUsageEvent::getSourceEntityType public function Gets the source entity type.
EntityUsageEvent::getTargetEntityId public function Gets the target entity id.
EntityUsageEvent::getTargetEntityType public function Gets the target entity type.
EntityUsageEvent::setCount public function Sets the count.
EntityUsageEvent::setFieldName public function Sets the field name.
EntityUsageEvent::setMethod public function Sets the method used to relate source entity with the target entity.
EntityUsageEvent::setSourceEntityId public function Sets the source entity id.
EntityUsageEvent::setSourceEntityLangcode public function Sets the source entity language code.
EntityUsageEvent::setSourceEntityRevisionId public function Sets the source entity revision ID.
EntityUsageEvent::setSourceEntityType public function Sets the source entity type.
EntityUsageEvent::setTargetEntityId public function Sets the target entity id.
EntityUsageEvent::setTargetEntityType public function Sets the target entity type.
EntityUsageEvent::__construct public function EntityUsageEvents constructor.