8.3.x Entity.php public Entity::save()
8.0.x Entity.php public Entity::save()
8.1.x Entity.php public Entity::save()
8.2.x Entity.php public Entity::save()
8.4.x Entity.php public Entity::save()

Saves an entity permanently.

When saving existing entities, the entity is assumed to be complete, partial updates of entities are not supported.

Return value

int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown.

Overrides EntityInterface::save

5 calls to Entity::save()
ConfigEntityBase::save in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Saves an entity permanently.
ContentModerationState::realSave in core/modules/content_moderation/src/Entity/ContentModerationState.php
Saves an entity permanently.
EntityTestMulChanged::save in core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php
Saves an entity permanently.
Feed::deleteItems in core/modules/aggregator/src/Entity/Feed.php
Deletes all items from a feed.
Feed::refreshItems in core/modules/aggregator/src/Entity/Feed.php
Updates the feed items by triggering the import process.
3 methods override Entity::save()
ConfigEntityBase::save in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Saves an entity permanently.
ContentModerationState::save in core/modules/content_moderation/src/Entity/ContentModerationState.php
Saves an entity permanently.
EntityTestMulChanged::save in core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php
Saves an entity permanently.

File

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

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

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