1. 8.3.x core/modules/migrate/src/Plugin/migrate/destination/Entity.php Entity
  2. 8.3.x core/lib/Drupal/Core/Entity/Entity.php Entity
  3. 8.3.x core/modules/views/src/Plugin/views/area/Entity.php Entity
  4. 8.3.x core/modules/views/src/Plugin/views/argument_validator/Entity.php Entity
  5. 8.0.x core/lib/Drupal/Core/Entity/Entity.php Entity
  6. 8.0.x core/modules/migrate/src/Plugin/migrate/destination/Entity.php Entity
  7. 8.0.x core/modules/views/src/Plugin/views/area/Entity.php Entity
  8. 8.0.x core/modules/views/src/Plugin/views/argument_validator/Entity.php Entity
  9. 8.1.x core/modules/views/src/Plugin/views/area/Entity.php Entity
  10. 8.1.x core/modules/views/src/Plugin/views/argument_validator/Entity.php Entity
  11. 8.1.x core/modules/migrate/src/Plugin/migrate/destination/Entity.php Entity
  12. 8.1.x core/lib/Drupal/Core/Entity/Entity.php Entity
  13. 8.2.x core/modules/migrate/src/Plugin/migrate/destination/Entity.php Entity
  14. 8.2.x core/lib/Drupal/Core/Entity/Entity.php Entity
  15. 8.2.x core/modules/views/src/Plugin/views/argument_validator/Entity.php Entity
  16. 8.2.x core/modules/views/src/Plugin/views/area/Entity.php Entity
  17. 8.4.x core/modules/views/src/Plugin/views/argument_validator/Entity.php Entity
  18. 8.4.x core/modules/views/src/Plugin/views/area/Entity.php Entity
  19. 8.4.x core/lib/Drupal/Core/Entity/Entity.php Entity
  20. 8.4.x core/modules/migrate/src/Plugin/migrate/destination/Entity.php Entity

Defines a base entity class.

Hierarchy

Expanded class hierarchy of Entity

3 files declare their use of Entity
ConfigEntityBase.php in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
EntityResolverManagerTest.php in core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
Contains \Drupal\Tests\Core\Entity\EntityResolverManagerTest.
EntityUrlTest.php in core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
4 string references to 'Entity'
drupal7.php in core/modules/migrate_drupal/tests/fixtures/drupal7.php
A database agnostic dump for testing purposes.
EntityTypeManager::__construct in core/lib/Drupal/Core/Entity/EntityTypeManager.php
Constructs a new Entity plugin manager.
views.area.schema.yml in core/modules/views/config/schema/views.area.schema.yml
core/modules/views/config/schema/views.area.schema.yml
views.view.files.yml in core/modules/file/config/optional/views.view.files.yml
core/modules/file/config/optional/views.view.files.yml

File

core/lib/Drupal/Core/Entity/Entity.php, line 20

Namespace

Drupal\Core\Entity
View source
abstract class Entity implements EntityInterface {

  use RefinableCacheableDependencyTrait;

  use DependencySerializationTrait {
      __sleep as traitSleep;
  }

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

  /**
   * Boolean indicating whether the entity should be forced to be new.
   *
   * @var bool
   */
  protected $enforceIsNew;

  /**
   * A typed data object wrapping this entity.
   *
   * @var \Drupal\Core\TypedData\ComplexDataInterface
   */
  protected $typedData;

  /**
   * Constructs an Entity object.
   *
   * @param array $values
   *   An array of values to set, keyed by property name. If the entity type
   *   has bundles, the bundle key has to be specified.
   * @param string $entity_type
   *   The type of the entity to create.
   */
  public function __construct(array $values, $entity_type) {
    $this->entityTypeId = $entity_type;
    // Set initial values.
    foreach ($values as $key => $value) {
      $this->$key = $value;
    }
  }

  /**
   * Gets the entity manager.
   *
   * @return \Drupal\Core\Entity\EntityManagerInterface
   *
   * @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
   *   Use \Drupal::entityTypeManager() instead in most cases. If the needed
   *   method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the
   *   deprecated \Drupal\Core\Entity\EntityManager to find the
   *   correct interface or service.
   */
  protected function entityManager() {
    return \Drupal::entityManager();
  }

  /**
   * Gets the entity type manager.
   *
   * @return \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected function entityTypeManager() {
    return \Drupal::entityTypeManager();
  }

  /**
   * Gets the language manager.
   *
   * @return \Drupal\Core\Language\LanguageManagerInterface
   */
  protected function languageManager() {
    return \Drupal::languageManager();
  }

  /**
   * Gets the UUID generator.
   *
   * @return \Drupal\Component\Uuid\UuidInterface
   */
  protected function uuidGenerator() {
    return \Drupal::service('uuid');
  }

  /**
   * {@inheritdoc}
   */
  public function id() {
    return isset($this->id) ? $this->id : NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function uuid() {
    return isset($this->uuid) ? $this->uuid : NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function isNew() {
    return !empty($this->enforceIsNew) || !$this->id();
  }

  /**
   * {@inheritdoc}
   */
  public function enforceIsNew($value = TRUE) {
    $this->enforceIsNew = $value;

    return $this;
  }

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

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

  /**
   * {@inheritdoc}
   */
  public function label() {
    $label = NULL;
    $entity_type = $this->getEntityType();
    if (($label_callback = $entity_type->getLabelCallback()) && is_callable($label_callback)) {
      $label = call_user_func($label_callback, $this);
    }
    elseif (($label_key = $entity_type->getKey('label')) && isset($this->{$label_key})) {
      $label = $this->{$label_key};
    }
    return $label;
  }

  /**
   * {@inheritdoc}
   */
  public function urlInfo($rel = 'canonical', array $options = []) {
    return $this->toUrl($rel, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function toUrl($rel = 'canonical', array $options = []) {
    if ($this->id() === NULL) {
      throw new EntityMalformedException(sprintf('The "%s" entity cannot have a URI as it does not have an ID', $this->getEntityTypeId()));
    }

    // The links array might contain URI templates set in annotations.
    $link_templates = $this->linkTemplates();

    // Links pointing to the current revision point to the actual entity. So
    // instead of using the 'revision' link, use the 'canonical' link.
    if ($rel === 'revision' && $this instanceof RevisionableInterface && $this->isDefaultRevision()) {
      $rel = 'canonical';
    }

    if (isset($link_templates[$rel])) {
      $route_parameters = $this->urlRouteParameters($rel);
      $route_name = "entity.{$this->entityTypeId}." . str_replace(array('-', 'drupal:'), array('_', ''), $rel);
      $uri = new Url($route_name, $route_parameters);
    }
    else {
      $bundle = $this->bundle();
      // A bundle-specific callback takes precedence over the generic one for
      // the entity type.
      $bundles = $this->entityManager()->getBundleInfo($this->getEntityTypeId());
      if (isset($bundles[$bundle]['uri_callback'])) {
        $uri_callback = $bundles[$bundle]['uri_callback'];
      }
      elseif ($entity_uri_callback = $this->getEntityType()->getUriCallback()) {
        $uri_callback = $entity_uri_callback;
      }

      // Invoke the callback to get the URI. If there is no callback, use the
      // default URI format.
      if (isset($uri_callback) && is_callable($uri_callback)) {
        $uri = call_user_func($uri_callback, $this);
      }
      else {
        throw new UndefinedLinkTemplateException("No link template '$rel' found for the '{$this->getEntityTypeId()}' entity type");
      }
    }

    // Pass the entity data through as options, so that alter functions do not
    // need to look up this entity again.
    $uri
    ->setOption('entity_type', $this->getEntityTypeId())
      ->setOption('entity', $this);

    // Display links by default based on the current language.
    // Link relations that do not require an existing entity should not be
    // affected by this entity's language, however.
    if (!in_array($rel, ['collection', 'add-page', 'add-form'], TRUE)) {
      $options += ['language' => $this->language()];
    }

    $uri_options = $uri->getOptions();
    $uri_options += $options;

    return $uri->setOptions($uri_options);
  }

  /**
   * {@inheritdoc}
   */
  public function hasLinkTemplate($rel) {
    $link_templates = $this->linkTemplates();
    return isset($link_templates[$rel]);
  }

  /**
   * Gets an array link templates.
   *
   * @return array
   *   An array of link templates containing paths.
   */
  protected function linkTemplates() {
    return $this->getEntityType()->getLinkTemplates();
  }

  /**
   * {@inheritdoc}
   */
  public function link($text = NULL, $rel = 'canonical', array $options = []) {
    return $this->toLink($text, $rel, $options)->toString();
  }

  /**
   * {@inheritdoc}
   */
  public function toLink($text = NULL, $rel = 'canonical', array $options = []) {
    if (!isset($text)) {
      $text = $this->label();
    }
    $url = $this->toUrl($rel);
    $options += $url->getOptions();
    $url->setOptions($options);
    return new Link($text, $url);
  }

  /**
   * {@inheritdoc}
   */
  public function url($rel = 'canonical', $options = array()) {
    // While self::toUrl() will throw an exception if the entity has no id,
    // the expected result for a URL is always a string.
    if ($this->id() === NULL || !$this->hasLinkTemplate($rel)) {
      return '';
    }

    $uri = $this->toUrl($rel);
    $options += $uri->getOptions();
    $uri->setOptions($options);
    return $uri->toString();
  }

  /**
   * Gets an array of placeholders for this entity.
   *
   * Individual entity classes may override this method to add additional
   * placeholders if desired. If so, they should be sure to replicate the
   * property caching logic.
   *
   * @param string $rel
   *   The link relationship type, for example: canonical or edit-form.
   *
   * @return array
   *   An array of URI placeholders.
   */
  protected function urlRouteParameters($rel) {
    $uri_route_parameters = [];

    if (!in_array($rel, ['collection', 'add-page', 'add-form'], TRUE)) {
      // The entity ID is needed as a route parameter.
      $uri_route_parameters[$this->getEntityTypeId()] = $this->id();
    }
    if ($rel === 'add-form' && ($this->getEntityType()->hasKey('bundle'))) {
      $parameter_name = $this->getEntityType()->getBundleEntityType() ? : $this->getEntityType()->getKey('bundle');
      $uri_route_parameters[$parameter_name] = $this->bundle();
    }
    if ($rel === 'revision' && $this instanceof RevisionableInterface) {
      $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId();
    }

    return $uri_route_parameters;
  }

  /**
   * {@inheritdoc}
   */
  public function uriRelationships() {
    return array_keys($this->linkTemplates());
  }

  /**
   * {@inheritdoc}
   */
  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
    if ($operation == 'create') {
      return $this->entityManager()
        ->getAccessControlHandler($this->entityTypeId)
        ->createAccess($this->bundle(), $account, [], $return_as_object);
    }
    return $this->entityManager()
      ->getAccessControlHandler($this->entityTypeId)
      ->access($this, $operation, $account, $return_as_object);
  }

  /**
   * {@inheritdoc}
   */
  public function language() {
    if ($key = $this->getEntityType()->getKey('langcode')) {
      $langcode = $this->$key;
      $language = $this->languageManager()->getLanguage($langcode);
      if ($language) {
        return $language;
      }
    }
    // Make sure we return a proper language object.
    $langcode = !empty($this->langcode) ? $this->langcode : LanguageInterface::LANGCODE_NOT_SPECIFIED;
    $language = new Language(array('id' => $langcode));
    return $language;
  }

  /**
   * {@inheritdoc}
   */
  public function save() {
    return $this->entityManager()->getStorage($this->entityTypeId)->save($this);
  }

  /**
   * {@inheritdoc}
   */
  public function delete() {
    if (!$this->isNew()) {
      $this->entityManager()->getStorage($this->entityTypeId)->delete(array($this->id() => $this));
    }
  }

  /**
   * {@inheritdoc}
   */
  public function createDuplicate() {
    $duplicate = clone $this;
    $entity_type = $this->getEntityType();
    // Reset the entity ID and indicate that this is a new entity.
    $duplicate->{$entity_type->getKey('id')} = NULL;
    $duplicate->enforceIsNew();

    // Check if the entity type supports UUIDs and generate a new one if so.
    if ($entity_type->hasKey('uuid')) {
      $duplicate->{$entity_type->getKey('uuid')} = $this->uuidGenerator()->generate();
    }
    return $duplicate;
  }

  /**
   * {@inheritdoc}
   */
  public function getEntityType() {
    return $this->entityManager()->getDefinition($this->getEntityTypeId());
  }

  /**
   * {@inheritdoc}
   */
  public function preSave(EntityStorageInterface $storage) {
    // Check if this is an entity bundle.
    if ($this->getEntityType()->getBundleOf()) {
      // Throw an exception if the bundle ID is longer than 32 characters.
      if (Unicode::strlen($this->id()) > EntityTypeInterface::BUNDLE_MAX_LENGTH) {
        throw new ConfigEntityIdLengthException("Attempt to create a bundle with an ID longer than " . EntityTypeInterface::BUNDLE_MAX_LENGTH . " characters: $this->id().");
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    $this->invalidateTagsOnSave($update);
  }

  /**
   * {@inheritdoc}
   */
  public static function preCreate(EntityStorageInterface $storage, array &$values) {
  }

  /**
   * {@inheritdoc}
   */
  public function postCreate(EntityStorageInterface $storage) {
  }

  /**
   * {@inheritdoc}
   */
  public static function preDelete(EntityStorageInterface $storage, array $entities) {
  }

  /**
   * {@inheritdoc}
   */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    static::invalidateTagsOnDelete($storage->getEntityType(), $entities);
  }

  /**
   * {@inheritdoc}
   */
  public static function postLoad(EntityStorageInterface $storage, array &$entities) {
  }

  /**
   * {@inheritdoc}
   */
  public function referencedEntities() {
    return array();
  }

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

  /**
   * {@inheritdoc}
   */
  public function getCacheTagsToInvalidate() {
    // @todo Add bundle-specific listing cache tag?
    //   https://www.drupal.org/node/2145751
    if ($this->isNew()) {
      return [];
    }
    return [$this->entityTypeId . ':' . $this->id()];
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    if ($this->cacheTags) {
      return Cache::mergeTags($this->getCacheTagsToInvalidate(), $this->cacheTags);
    }
    return $this->getCacheTagsToInvalidate();
  }

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

  /**
   * {@inheritdoc}
   */
  public static function load($id) {
    $entity_manager = \Drupal::entityManager();
    return $entity_manager->getStorage($entity_manager->getEntityTypeFromClass(get_called_class()))->load($id);
  }

  /**
   * {@inheritdoc}
   */
  public static function loadMultiple(array $ids = NULL) {
    $entity_manager = \Drupal::entityManager();
    return $entity_manager->getStorage($entity_manager->getEntityTypeFromClass(get_called_class()))->loadMultiple($ids);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(array $values = array()) {
    $entity_manager = \Drupal::entityManager();
    return $entity_manager->getStorage($entity_manager->getEntityTypeFromClass(get_called_class()))->create($values);
  }

  /**
   * Invalidates an entity's cache tags upon save.
   *
   * @param bool $update
   *   TRUE if the entity has been updated, or FALSE if it has been inserted.
   */
  protected function invalidateTagsOnSave($update) {
    // An entity was created or updated: invalidate its list cache tags. (An
    // updated entity may start to appear in a listing because it now meets that
    // listing's filtering requirements. A newly created entity may start to
    // appear in listings because it did not exist before.)
    $tags = $this->getEntityType()->getListCacheTags();
    if ($this->hasLinkTemplate('canonical')) {
      // Creating or updating an entity may change a cached 403 or 404 response.
      $tags = Cache::mergeTags($tags, ['4xx-response']);
    }
    if ($update) {
      // An existing entity was updated, also invalidate its unique cache tag.
      $tags = Cache::mergeTags($tags, $this->getCacheTagsToInvalidate());
    }
    Cache::invalidateTags($tags);
  }

  /**
   * Invalidates an entity's cache tags upon delete.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type definition.
   * @param \Drupal\Core\Entity\EntityInterface[] $entities
   *   An array of entities.
   */
  protected static function invalidateTagsOnDelete(EntityTypeInterface $entity_type, array $entities) {
    $tags = $entity_type->getListCacheTags();
    foreach ($entities as $entity) {
      // An entity was deleted: invalidate its own cache tag, but also its list
      // cache tags. (A deleted entity may cause changes in a paged list on
      // other pages than the one it's on. The one it's on is handled by its own
      // cache tag, but subsequent list pages would not be invalidated, hence we
      // must invalidate its list cache tags as well.)
      $tags = Cache::mergeTags($tags, $entity->getCacheTagsToInvalidate());
    }
    Cache::invalidateTags($tags);
  }

  /**
   * {@inheritdoc}
   */
  public function getOriginalId() {
    // By default, entities do not support renames and do not have original IDs.
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function setOriginalId($id) {
    // By default, entities do not support renames and do not have original IDs.
    // If the specified ID is anything except NULL, this should mark this entity
    // as no longer new.
    if ($id !== NULL) {
      $this->enforceIsNew(FALSE);
    }

    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function toArray() {
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function getTypedData() {
    if (!isset($this->typedData)) {
      $class = \Drupal::typedDataManager()->getDefinition('entity') ['class'];
      $this->typedData = $class::createFromEntity($this);
    }
    return $this->typedData;
  }

  /**
   * {@inheritdoc}
   */
  public function __sleep() {
    $this->typedData = NULL;
    return $this->traitSleep();
  }

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

  /**
   * {@inheritdoc}
   */
  public function getConfigDependencyName() {
    return $this->getEntityTypeId() . ':' . $this->bundle() . ':' . $this->uuid();
  }

  /**
   * {@inheritdoc}
   */
  public function getConfigTarget() {
    // For content entities, use the UUID for the config target identifier.
    // This ensures that references to the target can be deployed reliably.
    return $this->uuid();
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Prevents serializing any properties. Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
Entity::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
Entity::$entityTypeId protected property The entity type.
Entity::$typedData protected property A typed data object wrapping this entity.
Entity::access public function Checks data value access. Overrides AccessibleInterface::access 1
Entity::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
Entity::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
Entity::createDuplicate public function Creates a duplicate of the entity. Overrides EntityInterface::createDuplicate 2
Entity::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 1
Entity::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
Entity::entityManager Deprecated protected function Gets the entity manager.
Entity::entityTypeManager protected function Gets the entity type manager.
Entity::getCacheContexts public function The cache contexts associated with this object. Overrides RefinableCacheableDependencyTrait::getCacheContexts
Entity::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides RefinableCacheableDependencyTrait::getCacheMaxAge
Entity::getCacheTags public function The cache tags associated with this object. Overrides RefinableCacheableDependencyTrait::getCacheTags
Entity::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface::getCacheTagsToInvalidate 3
Entity::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
Entity::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityInterface::getConfigDependencyName 1
Entity::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityInterface::getConfigTarget 1
Entity::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
Entity::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
Entity::getOriginalId public function Gets the original ID. Overrides EntityInterface::getOriginalId 1
Entity::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
Entity::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
Entity::id public function Gets the identifier. Overrides EntityInterface::id 11
Entity::invalidateTagsOnDelete protected static function Invalidates an entity's cache tags upon delete. 1
Entity::invalidateTagsOnSave protected function Invalidates an entity's cache tags upon save. 1
Entity::isNew public function Determines whether the entity is new. Overrides EntityInterface::isNew 2
Entity::label public function Gets the label of the entity. Overrides EntityInterface::label 5
Entity::language public function Gets the language of the entity. Overrides EntityInterface::language 1
Entity::languageManager protected function Gets the language manager.
Entity::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityInterface::link 1
Entity::linkTemplates protected function Gets an array link templates. 1
Entity::load public static function Loads an entity. Overrides EntityInterface::load
Entity::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
Entity::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
Entity::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete 15
Entity::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
Entity::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityInterface::postSave 20
Entity::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 6
Entity::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface::preDelete 5
Entity::preSave public function Acts on an entity before the presave hook is invoked. Overrides EntityInterface::preSave 2
Entity::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
Entity::save public function Saves an entity permanently. Overrides EntityInterface::save 3
Entity::setOriginalId public function Sets the original ID. Overrides EntityInterface::setOriginalId 1
Entity::toArray public function Gets an array of all property values. Overrides EntityInterface::toArray 2
Entity::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
Entity::toUrl public function Gets the URL object for the entity. Overrides EntityInterface::toUrl 1
Entity::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
Entity::url public function Gets the public URL for this entity. Overrides EntityInterface::url 2
Entity::urlInfo public function Gets the URL object for the entity. Overrides EntityInterface::urlInfo 1
Entity::urlRouteParameters protected function Gets an array of placeholders for this entity. 1
Entity::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
Entity::uuidGenerator protected function Gets the UUID generator.
Entity::__construct public function Constructs an Entity object.
Entity::__sleep public function 2
RefinableCacheableDependencyTrait::$cacheContexts protected property Cache contexts.
RefinableCacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
RefinableCacheableDependencyTrait::$cacheTags protected property Cache tags.
RefinableCacheableDependencyTrait::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. Overrides RefinableCacheableDependencyInterface::addCacheableDependency 1
RefinableCacheableDependencyTrait::addCacheContexts public function Adds cache contexts. Overrides RefinableCacheableDependencyInterface::addCacheContexts
RefinableCacheableDependencyTrait::addCacheTags public function Adds cache tags. Overrides RefinableCacheableDependencyInterface::addCacheTags
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function Merges the maximum age (in seconds) with the existing maximum age. Overrides RefinableCacheableDependencyInterface::mergeCacheMaxAge