public SqlContentEntityStorage::save(EntityInterface $entity)
Saves the entity permanently.
\Drupal\Core\Entity\EntityInterface $entity: The entity to save.
SAVED_NEW or SAVED_UPDATED is returned depending on the operation performed.
\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.
Overrides EntityStorageBase::save
public function save(EntityInterface $entity) { $transaction = $this->database->startTransaction(); try { $return = parent::save($entity); // Ignore replica server temporarily. db_ignore_replica(); return $return; } catch (\Exception $e) { $transaction->rollback(); watchdog_exception($this->entityTypeId, $e); throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorage.php/function/SqlContentEntityStorage::save/8.1.x