function EntityStorageBase::save
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::save()
- 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::save()
- 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::save()
Overrides EntityStorageInterface::save
3 calls to EntityStorageBase::save()
- ConfigEntityStorage::save in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php - Implements Drupal\Core\Entity\EntityStorageInterface::save().
- KeyValueEntityStorage::save in core/
lib/ Drupal/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorage.php - Saves the entity permanently.
- SqlContentEntityStorage::save in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorage.php - Saves the entity permanently.
4 methods override EntityStorageBase::save()
- ConfigEntityStorage::save in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php - Implements Drupal\Core\Entity\EntityStorageInterface::save().
- ContentEntityNullStorage::save in core/
lib/ Drupal/ Core/ Entity/ ContentEntityNullStorage.php - Saves the entity permanently.
- KeyValueEntityStorage::save in core/
lib/ Drupal/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorage.php - Saves the entity permanently.
- SqlContentEntityStorage::save in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorage.php - Saves the entity permanently.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php, line 478
Class
- EntityStorageBase
- A base entity storage class.
Namespace
Drupal\Core\EntityCode
public function save(EntityInterface $entity) {
// Track if this entity is new.
$is_new = $entity->isNew();
// Execute presave logic and invoke the related hooks.
$id = $this->doPreSave($entity);
// Perform the save and reset the static cache for the changed entity.
$return = $this->doSave($id, $entity);
// Execute post save logic and invoke the related hooks.
$this->doPostSave($entity, !$is_new);
return $return;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.