You are here

public function SavedSearchType::preSave in Search API Saved Searches 8

Acts on an entity before the presave hook is invoked.

Used before the entity is saved and before invoking the presave hook.

Ensure that config entities which are bundles of other entities cannot have their ID changed.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

Throws

\Drupal\Core\Config\ConfigNameException Thrown when attempting to rename a bundle entity.

Overrides ConfigEntityBundleBase::preSave

File

src/Entity/SavedSearchType.php, line 127

Class

SavedSearchType
Provides an entity type for configuring how searches can be saved.

Namespace

Drupal\search_api_saved_searches\Entity

Code

public function preSave(EntityStorageInterface $storage) {
  parent::preSave($storage);

  // If we are in the process of syncing, we shouldn't change any entity
  // properties (or other configuration).
  if ($this
    ->isSyncing()) {
    return;
  }

  // @todo Do we need to check config overrides here?
  // Write the notification plugin settings to the persistent
  // $notification_settings property.
  $this
    ->writeChangesToSettings();
}