/**
  * {@inheritdoc}
  */
 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);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function save(EntityInterface $entity)
 {
     $transaction = $this->database->startTransaction();
     try {
         // Sync the changes made in the fields array to the internal values array.
         $entity->updateOriginalValues();
         $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);
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function invokeHook($hook, EntityInterface $entity)
 {
     if ($hook == 'presave') {
         $this->invokeFieldMethod('preSave', $entity);
     }
     parent::invokeHook($hook, $entity);
 }
 /**
  * {@inheritdoc}
  */
 public function loadByProperties(array $values = [])
 {
     // If UUID is queried, just swap it with the ID. They are the same but UUID
     // is not stored, while on ID we can rely.
     $uuid_key = $this->entityType->getKey('uuid');
     if (isset($values[$uuid_key]) && !isset($values['id'])) {
         $values['id'] = $values[$uuid_key];
         unset($values[$uuid_key]);
     }
     return parent::loadByProperties($values);
 }