Entity::getCacheTags

public Entity::getCacheTags() The cache tags associated with this object. When this object is modified, these cache tags will be invalidated. Return value string[] A set of cache tags. Overrides RefinableCacheableDependencyTrait::getCacheTags File core/lib/Drupal/Core/Entity/Entity.php, line 480 Class Entity Defines a base entity class. Namespace Drupal\Core\Entity Code public function getCacheTags() { if ($this->cacheTags) { return Cache::mergeTags($this->getCacheTagsToIn

Entity::getCacheMaxAge

public Entity::getCacheMaxAge() The maximum age for which this object may be cached. Return value int The maximum time in seconds that this object may be cached. Overrides RefinableCacheableDependencyTrait::getCacheMaxAge File core/lib/Drupal/Core/Entity/Entity.php, line 490 Class Entity Defines a base entity class. Namespace Drupal\Core\Entity Code public function getCacheMaxAge() { return $this->cacheMaxAge; }

Entity::getCacheContexts

public Entity::getCacheContexts() The cache contexts associated with this object. These identify a specific variation/representation of the object. Cache contexts are tokens: placeholders that are converted to cache keys by the @cache_contexts_manager service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache. Return value string[] An array of cache context tokens, used to generate a cache ID. Overri

Entity::entityTypeManager

protected Entity::entityTypeManager() Gets the entity type manager. Return value \Drupal\Core\Entity\EntityTypeManagerInterface File core/lib/Drupal/Core/Entity/Entity.php, line 86 Class Entity Defines a base entity class. Namespace Drupal\Core\Entity Code protected function entityTypeManager() { return \Drupal::entityTypeManager(); }

Entity::entityManager

protected Entity::entityManager() Gets the entity manager. Return value \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. File core/lib/Drupal/Core/Entity/Entity.php, line 77 Class Entity Defines a b

Entity::enforceIsNew

public Entity::enforceIsNew($value = TRUE) Enforces an entity to be new. Allows migrations to create entities with pre-defined IDs by forcing the entity to be new before saving. Parameters bool $value: (optional) Whether the entity should be forced to be new. Defaults to TRUE. Return value $this Overrides EntityInterface::enforceIsNew See also \Drupal\Core\Entity\EntityInterface::isNew() File core/lib/Drupal/Core/Entity/Entity.php, line 132 Class Entity Defines a base entity class. Na

Entity::delete

public Entity::delete() Deletes an entity permanently. Throws \Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown. Overrides EntityInterface::delete File core/lib/Drupal/Core/Entity/Entity.php, line 370 Class Entity Defines a base entity class. Namespace Drupal\Core\Entity Code public function delete() { if (!$this->isNew()) { $this->entityManager()->getStorage($this->entityTypeId)->delete(array($this->id() => $this)); } }

Entity::createDuplicate

public Entity::createDuplicate() Creates a duplicate of the entity. Return value static A clone of $this with all identifiers unset, so saving it inserts a new entity into the storage system. Overrides EntityInterface::createDuplicate File core/lib/Drupal/Core/Entity/Entity.php, line 379 Class Entity Defines a base entity class. Namespace Drupal\Core\Entity Code public function createDuplicate() { $duplicate = clone $this; $entity_type = $this->getEntityType(); // Reset the e

Entity::create

public static Entity::create(array $values = array()) Constructs a new entity object, without permanently saving it. Parameters array $values: (optional) An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified. Return value static The entity object. Overrides EntityInterface::create File core/lib/Drupal/Core/Entity/Entity.php, line 513 Class Entity Defines a base entity class. Namespace Drupal\Core\Entity Code public stati

Entity::bundle

public Entity::bundle() Gets the bundle of the entity. Return value string The bundle of the entity. Defaults to the entity type ID if the entity type does not make use of different bundles. Overrides EntityInterface::bundle File core/lib/Drupal/Core/Entity/Entity.php, line 148 Class Entity Defines a base entity class. Namespace Drupal\Core\Entity Code public function bundle() { return $this->entityTypeId; }