protected ContentEntityStorageBase::doSave($id, EntityInterface $entity)
Performs storage-specific saving of the entity.
Parameters
int|string $id: The original entity ID.
\Drupal\Core\Entity\EntityInterface $entity: The entity to save.
Return value
bool|int If the record insert or update failed, returns FALSE. If it succeeded, returns SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
Overrides EntityStorageBase::doSave
File
- core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 244
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\Entity
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | protected function doSave( $id , EntityInterface $entity ) { /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ if ( $entity ->isNew()) { // Ensure the entity is still seen as new after assigning it an id, while // storing its data. $entity ->enforceIsNew(); if ( $this ->entityType->isRevisionable()) { $entity ->setNewRevision(); } $return = SAVED_NEW; } else { // @todo Consider returning a different value when saving a non-default // entity revision. See https://www.drupal.org/node/2509360. $return = $entity ->isDefaultRevision() ? SAVED_UPDATED : FALSE; } $this ->populateAffectedRevisionTranslations( $entity ); $this ->doSaveFieldItems( $entity ); return $return ; } |
Please login to continue.