You are here

class AuditLogEvent in Audit Log 8

Same name and namespace in other branches
  1. 8.2 src/AuditLogEvent.php \Drupal\audit_log\AuditLogEvent

Represents a single auditable event for logging.

@package Drupal\audit_log

Hierarchy

Expanded class hierarchy of AuditLogEvent

1 file declares its use of AuditLogEvent
AuditLogEventTest.php in tests/src/Unit/AuditLogEventTest.php

File

src/AuditLogEvent.php, line 13

Namespace

Drupal\audit_log
View source
class AuditLogEvent implements AuditLogEventInterface {

  /**
   * The user that triggered the audit event.
   *
   * @var \Drupal\user\UserInterface
   */
  protected $user;

  /**
   * The entity being modified.
   *
   * @var \Drupal\Core\Entity\EntityInterface
   */
  protected $entity;

  /**
   * The audit message to write to the log.
   *
   * @var string
   */
  protected $message;

  /**
   * Array of variables that match the message string replacement tokens.
   *
   * @var array
   */
  protected $messagePlaceholders = [];

  /**
   * The type of event being reported.
   *
   * @var string
   */
  protected $eventType;

  /**
   * The original state of the object before the event occurred.
   *
   * @var string
   */
  protected $previousState;

  /**
   * The new state of the object after the event occurred.
   *
   * @var string
   */
  protected $currentState;

  /**
   * Timestamp for when the event occurred.
   *
   * @var int
   */
  protected $requestTime;

  /**
   * {@inheritdoc}
   */
  public function setUser(AccountInterface $user) {
    $this->user = $user;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setEntity(EntityInterface $entity) {
    $this->entity = $entity;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setMessage($message) {
    $this->message = $message;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setMessagePlaceholders($variables) {
    $this->messagePlaceholders = $variables;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setEventType($event_type) {
    $this->eventType = $event_type;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setPreviousState($state) {
    $this->previousState = $state;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setCurrentState($state) {
    $this->currentState = $state;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setRequestTime($request_time) {
    $this->requestTime = $request_time;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getUser() {
    return $this->user;
  }

  /**
   * {@inheritdoc}
   */
  public function getEntity() {
    return $this->entity;
  }

  /**
   * {@inheritdoc}
   */
  public function getMessage() {
    return $this->message;
  }

  /**
   * {@inheritdoc}
   */
  public function getMessagePlaceholders() {
    return $this->messagePlaceholders;
  }

  /**
   * {@inheritdoc}
   */
  public function getEventType() {
    return $this->eventType;
  }

  /**
   * {@inheritdoc}
   */
  public function getPreviousState() {
    return $this->previousState;
  }

  /**
   * {@inheritdoc}
   */
  public function getCurrentState() {
    return $this->currentState;
  }

  /**
   * {@inheritdoc}
   */
  public function getRequestTime() {
    return $this->requestTime;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AuditLogEvent::$currentState protected property The new state of the object after the event occurred.
AuditLogEvent::$entity protected property The entity being modified.
AuditLogEvent::$eventType protected property The type of event being reported.
AuditLogEvent::$message protected property The audit message to write to the log.
AuditLogEvent::$messagePlaceholders protected property Array of variables that match the message string replacement tokens.
AuditLogEvent::$previousState protected property The original state of the object before the event occurred.
AuditLogEvent::$requestTime protected property Timestamp for when the event occurred.
AuditLogEvent::$user protected property The user that triggered the audit event.
AuditLogEvent::getCurrentState public function Retrieves the new state of the object after the event occurred. Overrides AuditLogEventInterface::getCurrentState
AuditLogEvent::getEntity public function Retrieves the entity that was modified. Overrides AuditLogEventInterface::getEntity
AuditLogEvent::getEventType public function Retrieves the type of event that was triggered. Overrides AuditLogEventInterface::getEventType
AuditLogEvent::getMessage public function Retrieves the untranslated audit log message for the event. Overrides AuditLogEventInterface::getMessage
AuditLogEvent::getMessagePlaceholders public function Retrieves the replacement tokens for the log message. Overrides AuditLogEventInterface::getMessagePlaceholders
AuditLogEvent::getPreviousState public function Retrieves the original state of the object before the event occurred. Overrides AuditLogEventInterface::getPreviousState
AuditLogEvent::getRequestTime public function The timestamp for when the event was initiated. Overrides AuditLogEventInterface::getRequestTime
AuditLogEvent::getUser public function Retrieves the user object for the user that triggered the event. Overrides AuditLogEventInterface::getUser
AuditLogEvent::setCurrentState public function Stores the new state of the object after the event occurred. Overrides AuditLogEventInterface::setCurrentState
AuditLogEvent::setEntity public function Stores the entity that triggered the audit event. Overrides AuditLogEventInterface::setEntity
AuditLogEvent::setEventType public function Stores the type of event being reported. Overrides AuditLogEventInterface::setEventType
AuditLogEvent::setMessage public function Stores the untranslated audit message to write to the log. Overrides AuditLogEventInterface::setMessage
AuditLogEvent::setMessagePlaceholders public function Stores the replacement tokens for the log message. Overrides AuditLogEventInterface::setMessagePlaceholders
AuditLogEvent::setPreviousState public function Stores the original state of the object before the event occurred. Overrides AuditLogEventInterface::setPreviousState
AuditLogEvent::setRequestTime public function Sets the timestamp for the event request. Overrides AuditLogEventInterface::setRequestTime
AuditLogEvent::setUser public function Stores the user that triggers the audit event. Overrides AuditLogEventInterface::setUser