public SqlContentEntityStorage::save(EntityInterface $entity)
Saves the entity permanently.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to save.
Return value
SAVED_NEW or SAVED_UPDATED is returned depending on the operation performed.
Throws
\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.
Overrides EntityStorageBase::save
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 758
Class
- SqlContentEntityStorage
- A content entity database storage implementation.
Namespace
Drupal\Core\Entity\Sql
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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 ); } } |
Please login to continue.