You are here

class EntityNotFoundException in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 src/EntityNotFoundException.php \Drupal\salesforce\EntityNotFoundException
  2. 5.0.x src/EntityNotFoundException.php \Drupal\salesforce\EntityNotFoundException

EntityNotFoundException extends Drupal\salesforce\Exception.

Thrown when a mapped entity cannot be loaded.

Hierarchy

Expanded class hierarchy of EntityNotFoundException

3 files declare their use of EntityNotFoundException
PushQueue.php in modules/salesforce_push/src/PushQueue.php
Rest.php in modules/salesforce_push/src/Plugin/SalesforcePushQueueProcessor/Rest.php
SalesforcePushQueueProcessorRestTest.php in modules/salesforce_push/tests/src/Unit/SalesforcePushQueueProcessorRestTest.php

File

src/EntityNotFoundException.php, line 14

Namespace

Drupal\salesforce
View source
class EntityNotFoundException extends \RuntimeException {
  use StringTranslationTrait;

  /**
   * A list of entity properties, for logging.
   *
   * @var mixed
   */
  protected $entityProperties;

  /**
   * Entity type id, for logging.
   *
   * @var string
   */
  protected $entityTypeId;

  /**
   * EntityNotFoundException constructor.
   *
   * @param mixed $entityProperties
   *   Entity properties.
   * @param string $entityTypeId
   *   Entity type id.
   * @param \Throwable|null $previous
   *   Previous exception.
   */
  public function __construct($entityProperties, $entityTypeId, Throwable $previous = NULL) {
    parent::__construct($this
      ->t('Entity not found. type: %type properties: %props', [
      '%type' => $entityTypeId,
      '%props' => var_export($entityProperties, TRUE),
    ]), 0, $previous);
    $this->entityProperties = $entityProperties;
    $this->entityTypeId = $entityTypeId;
  }

  /**
   * Getter.
   *
   * @return mixed
   *   The entityProperties.
   */
  public function getEntityProperties() {
    return $this->entityProperties;
  }

  /**
   * Getter.
   *
   * @return string
   *   The entityTypeId.
   */
  public function getEntityTypeId() {
    return $this->entityTypeId;
  }

  /**
   * Get a formattable message.
   *
   * @return \Drupal\Component\Render\FormattableMarkup
   *   The message.
   */
  public function getFormattableMessage() {
    return new FormattableMarkup('Entity not found. type: %type properties: %props', [
      '%type' => $this->entityTypeId,
      '%props' => var_export($this->entityProperties, TRUE),
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityNotFoundException::$entityProperties protected property A list of entity properties, for logging.
EntityNotFoundException::$entityTypeId protected property Entity type id, for logging.
EntityNotFoundException::getEntityProperties public function Getter.
EntityNotFoundException::getEntityTypeId public function Getter.
EntityNotFoundException::getFormattableMessage public function Get a formattable message.
EntityNotFoundException::__construct public function EntityNotFoundException constructor.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.