You are here

class Server in Search API 8

Defines the search server configuration entity.

Plugin annotation


@ConfigEntityType(
  id = "search_api_server",
  label = @Translation("Search server"),
  label_collection = @Translation("Search servers"),
  label_singular = @Translation("search server"),
  label_plural = @Translation("search servers"),
  label_count = @PluralTranslation(
    singular = "@count search server",
    plural = "@count search servers",
  ),
  handlers = {
    "storage" = "Drupal\search_api\Entity\SearchApiConfigEntityStorage",
    "form" = {
      "default" = "Drupal\search_api\Form\ServerForm",
      "edit" = "Drupal\search_api\Form\ServerForm",
      "delete" = "Drupal\search_api\Form\ServerDeleteConfirmForm",
      "disable" = "Drupal\search_api\Form\ServerDisableConfirmForm",
      "clear" = "Drupal\search_api\Form\ServerClearConfirmForm",
    },
  },
  admin_permission = "administer search_api",
  config_prefix = "server",
  entity_keys = {
    "id" = "id",
    "label" = "name",
    "uuid" = "uuid",
    "status" = "status",
  },
  config_export = {
    "id",
    "name",
    "description",
    "backend",
    "backend_config",
  },
  links = {
    "canonical" = "/admin/config/search/search-api/server/{search_api_server}",
    "add-form" = "/admin/config/search/search-api/add-server",
    "edit-form" = "/admin/config/search/search-api/server/{search_api_server}/edit",
    "delete-form" = "/admin/config/search/search-api/server/{search_api_server}/delete",
    "disable" = "/admin/config/search/search-api/server/{search_api_server}/disable",
    "enable" = "/admin/config/search/search-api/server/{search_api_server}/enable",
  }
)

Hierarchy

Expanded class hierarchy of Server

27 files declare their use of Server
BackendPluginBase.php in src/Backend/BackendPluginBase.php
BackendTest.php in modules/search_api_db/tests/src/Kernel/BackendTest.php
BackendTestBase.php in tests/src/Kernel/BackendTestBase.php
CliTest.php in tests/src/Kernel/System/CliTest.php
CommandHelperTest.php in tests/src/Kernel/System/CommandHelperTest.php

... See full list

6 string references to 'Server'
drush_search_api_list in ./search_api.drush.inc
Prints a list of all search indexes.
IndexForm::buildEntityForm in src/Form/IndexForm.php
Builds the form for the basic index properties.
IndexListBuilder::buildRow in src/IndexListBuilder.php
Builds a row for an entity in the entity listing.
template_preprocess_search_api_index in ./search_api.theme.inc
Prepares variables for search_api_index templates.
tour.tour.search-api-index-form.yml in config/optional/tour.tour.search-api-index-form.yml
config/optional/tour.tour.search-api-index-form.yml

... See full list

File

src/Entity/Server.php, line 65

Namespace

Drupal\search_api\Entity
View source
class Server extends ConfigEntityBase implements ServerInterface {
  use InstallingTrait;
  use LoggerTrait;

  /**
   * The ID of the server.
   *
   * @var string
   */
  protected $id;

  /**
   * The displayed name of the server.
   *
   * @var string
   */
  protected $name;

  /**
   * The displayed description of the server.
   *
   * @var string
   */
  protected $description = '';

  /**
   * The ID of the backend plugin.
   *
   * @var string
   */
  protected $backend;

  /**
   * The backend plugin configuration.
   *
   * @var array
   */
  protected $backend_config = [];

  /**
   * The backend plugin instance.
   *
   * @var \Drupal\search_api\Backend\BackendInterface
   */
  protected $backendPlugin;

  /**
   * The features this server supports.
   *
   * @var string[]|null
   */
  protected $features;

  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    return $this->description;
  }

  /**
   * {@inheritdoc}
   */
  public function hasValidBackend() {
    $backend_plugin_definition = \Drupal::service('plugin.manager.search_api.backend')
      ->getDefinition($this
      ->getBackendId(), FALSE);
    return !empty($backend_plugin_definition);
  }

  /**
   * {@inheritdoc}
   */
  public function getBackendId() {
    return $this->backend;
  }

  /**
   * {@inheritdoc}
   */
  public function getBackend() {
    if (!$this->backendPlugin) {
      $backend_plugin_manager = \Drupal::service('plugin.manager.search_api.backend');
      $config = $this->backend_config;
      $config['#server'] = $this;
      if (!($this->backendPlugin = $backend_plugin_manager
        ->createInstance($this
        ->getBackendId(), $config))) {
        $backend_id = $this
          ->getBackendId();
        $label = $this
          ->label();
        throw new SearchApiException("The backend with ID '{$backend_id}' could not be retrieved for server '{$label}'.");
      }
    }
    return $this->backendPlugin;
  }

  /**
   * {@inheritdoc}
   */
  public function getBackendConfig() {
    return $this->backend_config;
  }

  /**
   * {@inheritdoc}
   */
  public function setBackendConfig(array $backend_config) {
    $this->backend_config = $backend_config;

    // In case the backend plugin is already loaded, make sure the configuration
    // stays in sync.
    if ($this->backendPlugin && $this
      ->getBackend()
      ->getConfiguration() !== $backend_config) {
      $this
        ->getBackend()
        ->setConfiguration($backend_config);
    }
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getIndexes(array $properties = []) {
    $storage = \Drupal::entityTypeManager()
      ->getStorage('search_api_index');
    return $storage
      ->loadByProperties([
      'server' => $this
        ->id(),
    ] + $properties);
  }

  /**
   * {@inheritdoc}
   */
  public function viewSettings() {
    return $this
      ->hasValidBackend() ? $this
      ->getBackend()
      ->viewSettings() : [];
  }

  /**
   * {@inheritdoc}
   */
  public function isAvailable() {
    return $this
      ->hasValidBackend() ? $this
      ->getBackend()
      ->isAvailable() : FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function supportsFeature($feature) {
    return in_array($feature, $this
      ->getSupportedFeatures());
  }

  /**
   * {@inheritdoc}
   */
  public function getSupportedFeatures() {
    if (!isset($this->features)) {
      $this->features = [];
      if ($this
        ->hasValidBackend()) {
        $this->features = $this
          ->getBackend()
          ->getSupportedFeatures();
      }
      $description = 'This hook is deprecated in search_api:8.x-1.14 and is removed from search_api:2.0.0. Please use the "search_api.determining_server_features" event instead. See https://www.drupal.org/node/3059866';
      \Drupal::moduleHandler()
        ->alterDeprecated($description, 'search_api_server_features', $this->features, $this);

      /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher */
      $eventDispatcher = \Drupal::getContainer()
        ->get('event_dispatcher');
      $eventDispatcher
        ->dispatch(SearchApiEvents::DETERMINING_SERVER_FEATURES, new DeterminingServerFeaturesEvent($this->features, $this));
    }
    return $this->features;
  }

  /**
   * {@inheritdoc}
   */
  public function supportsDataType($type) {
    if ($this
      ->hasValidBackend()) {
      return $this
        ->getBackend()
        ->supportsDataType($type);
    }
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getDiscouragedProcessors() {
    if ($this
      ->hasValidBackend()) {
      return $this
        ->getBackend()
        ->getDiscouragedProcessors();
    }
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getBackendDefinedFields(IndexInterface $index) {
    if ($this
      ->hasValidBackend()) {
      return $this
        ->getBackend()
        ->getBackendDefinedFields($index);
    }
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function addIndex(IndexInterface $index) {
    $server_task_manager = \Drupal::getContainer()
      ->get('search_api.server_task_manager');

    // When freshly adding an index to a server, it doesn't make any sense to
    // execute possible other tasks for that server/index combination.
    // (removeIndex() is implicit when adding an index which was already added.)
    $server_task_manager
      ->delete($this, $index);
    try {
      if ($server_task_manager
        ->execute($this)) {
        $this
          ->getBackend()
          ->addIndex($index);
        return;
      }
    } catch (SearchApiException $e) {
      $vars = [
        '%server' => $this
          ->label(),
        '%index' => $index
          ->label(),
      ];
      $this
        ->logException($e, '%type while adding index %index to server %server: @message in %function (line %line of %file).', $vars);
    }
    $task_manager = \Drupal::getContainer()
      ->get('search_api.task_manager');
    $task_manager
      ->addTask(__FUNCTION__, $this, $index);
  }

  /**
   * {@inheritdoc}
   */
  public function updateIndex(IndexInterface $index) {
    $server_task_manager = \Drupal::getContainer()
      ->get('search_api.server_task_manager');
    try {
      if ($server_task_manager
        ->execute($this)) {
        $this
          ->getBackend()
          ->updateIndex($index);
        return;
      }
    } catch (SearchApiException $e) {
      $vars = [
        '%server' => $this
          ->label(),
        '%index' => $index
          ->label(),
      ];
      $this
        ->logException($e, '%type while updating the fields of index %index on server %server: @message in %function (line %line of %file).', $vars);
    }
    $task_manager = \Drupal::getContainer()
      ->get('search_api.task_manager');
    $task_manager
      ->addTask(__FUNCTION__, $this, $index, $index->original ?? NULL);
  }

  /**
   * {@inheritdoc}
   */
  public function removeIndex($index) {
    $server_task_manager = \Drupal::getContainer()
      ->get('search_api.server_task_manager');

    // When removing an index from a server, it doesn't make any sense anymore
    // to delete items from it, or react to other changes.
    $server_task_manager
      ->delete($this, $index);
    try {
      if ($server_task_manager
        ->execute($this)) {
        $this
          ->getBackend()
          ->removeIndex($index);
        return;
      }
    } catch (SearchApiException $e) {
      $vars = [
        '%server' => $this
          ->label(),
        '%index' => is_object($index) ? $index
          ->label() : $index,
      ];
      $this
        ->logException($e, '%type while removing index %index from server %server: @message in %function (line %line of %file).', $vars);
    }
    $task_manager = \Drupal::getContainer()
      ->get('search_api.task_manager');
    $data = NULL;
    if (!is_object($index)) {
      $data = $index;
      $index = NULL;
    }
    $task_manager
      ->addTask(__FUNCTION__, $this, $index, $data);
  }

  /**
   * {@inheritdoc}
   */
  public function indexItems(IndexInterface $index, array $items) {
    $server_task_manager = \Drupal::getContainer()
      ->get('search_api.server_task_manager');
    if ($server_task_manager
      ->execute($this)) {
      return $this
        ->getBackend()
        ->indexItems($index, $items);
    }
    $index_label = $index
      ->label();
    throw new SearchApiException("Could not index items on index '{$index_label}' because pending server tasks could not be executed.");
  }

  /**
   * {@inheritdoc}
   */
  public function deleteItems(IndexInterface $index, array $item_ids) {
    if ($index
      ->isReadOnly()) {
      $vars = [
        '%index' => $index
          ->label(),
      ];
      $this
        ->getLogger()
        ->warning('Trying to delete items from index %index which is marked as read-only.', $vars);
      return;
    }
    $server_task_manager = \Drupal::getContainer()
      ->get('search_api.server_task_manager');
    try {
      if ($server_task_manager
        ->execute($this)) {
        $this
          ->getBackend()
          ->deleteItems($index, $item_ids);

        // Clear search api list caches.
        Cache::invalidateTags([
          'search_api_list:' . $index
            ->id(),
        ]);
        return;
      }
    } catch (SearchApiException $e) {
      $vars = [
        '%server' => $this
          ->label(),
      ];
      $this
        ->logException($e, '%type while deleting items from server %server: @message in %function (line %line of %file).', $vars);
    }
    $task_manager = \Drupal::getContainer()
      ->get('search_api.task_manager');
    $task_manager
      ->addTask(__FUNCTION__, $this, $index, $item_ids);
  }

  /**
   * {@inheritdoc}
   */
  public function deleteAllIndexItems(IndexInterface $index, $datasource_id = NULL) {
    if ($index
      ->isReadOnly()) {
      $vars = [
        '%index' => $index
          ->label(),
      ];
      $this
        ->getLogger()
        ->warning('Trying to delete items from index %index which is marked as read-only.', $vars);
      return;
    }
    $server_task_manager = \Drupal::getContainer()
      ->get('search_api.server_task_manager');
    if (!$datasource_id) {

      // If we're deleting all items of the index, there's no point in keeping
      // any other "delete items" tasks.
      $types = [
        'deleteItems',
        'deleteAllIndexItems',
      ];
      $server_task_manager
        ->delete($this, $index, $types);
    }
    try {
      if ($server_task_manager
        ->execute($this)) {
        $this
          ->getBackend()
          ->deleteAllIndexItems($index, $datasource_id);

        // Clear search api list caches.
        Cache::invalidateTags([
          'search_api_list:' . $index
            ->id(),
        ]);
        return;
      }
    } catch (SearchApiException $e) {
      $vars = [
        '%server' => $this
          ->label(),
        '%index' => $index
          ->label(),
      ];
      $this
        ->logException($e, '%type while deleting items of index %index from server %server: @message in %function (line %line of %file).', $vars);
    }
    $task_manager = \Drupal::getContainer()
      ->get('search_api.task_manager');
    $task_manager
      ->addTask(__FUNCTION__, $this, $index, $datasource_id);
  }

  /**
   * {@inheritdoc}
   */
  public function deleteAllItems() {
    $failed = [];
    $properties['status'] = TRUE;
    $properties['read_only'] = FALSE;
    foreach ($this
      ->getIndexes($properties) as $index) {
      try {
        $this
          ->getBackend()
          ->deleteAllIndexItems($index);
        Cache::invalidateTags([
          'search_api_list:' . $index
            ->id(),
        ]);
      } catch (SearchApiException $e) {
        $args = [
          '%index' => $index
            ->label(),
        ];
        $this
          ->logException($e, '%type while deleting all items from index %index: @message in %function (line %line of %file).', $args);
        $failed[] = $index
          ->label();
      }
    }
    if (!empty($e)) {
      $server_name = $this
        ->label();
      $failed = implode(', ', $failed);
      throw new SearchApiException("Deleting all items from server '{$server_name}' failed for the following (write-enabled) indexes: {$failed}.", 0, $e);
    }
    $types = [
      'deleteItems',
      'deleteAllIndexItems',
    ];
    \Drupal::getContainer()
      ->get('search_api.server_task_manager')
      ->delete($this, NULL, $types);
  }

  /**
   * {@inheritdoc}
   */
  public function search(QueryInterface $query) {
    $this
      ->getBackend()
      ->search($query);
  }

  /**
   * {@inheritdoc}
   */
  public function preSave(EntityStorageInterface $storage) {
    parent::preSave($storage);

    // The rest of the code only applies to updates.
    if (!isset($this->original)) {
      return;
    }

    // Retrieve active config overrides for this server.
    $overrides = Utility::getConfigOverrides($this);

    // If there are overrides for the backend or its configuration, attempt to
    // apply them for the preUpdate() call.
    if (isset($overrides['backend']) || isset($overrides['backend_config'])) {
      $backend_config = $this
        ->getBackendConfig();
      if (isset($overrides['backend_config'])) {
        $backend_config = $overrides['backend_config'];
      }
      $backend_id = $this
        ->getBackendId();
      if (isset($overrides['backend'])) {
        $backend_id = $overrides['backend'];
      }
      $backend_plugin_manager = \Drupal::service('plugin.manager.search_api.backend');
      $backend_config['#server'] = $this;
      if (!($backend = $backend_plugin_manager
        ->createInstance($backend_id, $backend_config))) {
        $label = $this
          ->label();
        throw new SearchApiException("The backend with ID '{$backend_id}' could not be retrieved for server '{$label}'.");
      }
    }
    else {
      $backend = $this
        ->getBackend();
    }
    $backend
      ->preUpdate();

    // If the server is being disabled, also disable all its indexes.
    if (!$this
      ->isSyncing() && !$this
      ->isInstallingFromExtension() && !isset($overrides['status']) && !$this
      ->status() && $this->original
      ->status()) {
      foreach ($this
        ->getIndexes([
        'status' => TRUE,
      ]) as $index) {

        /** @var \Drupal\search_api\IndexInterface $index */
        $index
          ->setStatus(FALSE)
          ->save();
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    if ($this
      ->hasValidBackend()) {
      if ($update) {
        $reindexing_necessary = $this
          ->getBackend()
          ->postUpdate();
        if ($reindexing_necessary) {
          foreach ($this
            ->getIndexes() as $index) {
            $index
              ->reindex();
          }
        }
      }
      else {
        $this
          ->getBackend()
          ->postInsert();
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function preDelete(EntityStorageInterface $storage, array $entities) {

    // @todo This will, via Index::onDependencyRemoval(), remove all indexes
    //   from this server, triggering the server's removeIndex() method. This
    //   is, at best, wasted performance and could at worst lead to a bug if
    //   removeIndex() saves the server. We should try what happens when this is
    //   the case, whether there really is a bug, and try to fix it somehow –
    //   maybe clever detection of this case in removeIndex() or
    //   Index::postSave(). $server->isUninstalling() might help?
    parent::preDelete($storage, $entities);

    // Iterate through the servers, executing the backends' preDelete() methods
    // and removing all their pending server tasks.
    foreach ($entities as $server) {

      /** @var \Drupal\search_api\ServerInterface $server */
      if ($server
        ->hasValidBackend()) {
        $server
          ->getBackend()
          ->preDelete();
      }
      \Drupal::getContainer()
        ->get('search_api.server_task_manager')
        ->delete($server);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    parent::calculateDependencies();

    // Add the backend's dependencies.
    if ($this
      ->hasValidBackend()) {
      $this
        ->calculatePluginDependencies($this
        ->getBackend());
    }
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function onDependencyRemoval(array $dependencies) {
    $changed = parent::onDependencyRemoval($dependencies);
    if ($this
      ->hasValidBackend()) {
      $removed_backend_dependencies = [];
      $backend = $this
        ->getBackend();
      foreach ($backend
        ->calculateDependencies() as $dependency_type => $list) {
        if (isset($dependencies[$dependency_type])) {
          $removed_backend_dependencies[$dependency_type] = array_intersect_key($dependencies[$dependency_type], array_flip($list));
        }
      }
      $removed_backend_dependencies = array_filter($removed_backend_dependencies);
      if ($removed_backend_dependencies) {
        if ($backend
          ->onDependencyRemoval($removed_backend_dependencies)) {
          $this->backend_config = $backend
            ->getConfiguration();
          $changed = TRUE;
        }
      }
    }
    return $changed;
  }

  /**
   * Implements the magic __clone() method.
   *
   * Prevents the backend plugin instance from being cloned.
   */
  public function __clone() {
    $this->backendPlugin = NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
ConfigEntityBase::$isUninstalling private property Whether the config is being deleted by the uninstall process.
ConfigEntityBase::$langcode protected property The language code of the entity's default language.
ConfigEntityBase::$originalId protected property The original ID of the configuration entity.
ConfigEntityBase::$status protected property The enabled/disabled status of the configuration entity. 4
ConfigEntityBase::$third_party_settings protected property Third party entity settings.
ConfigEntityBase::$trustedData protected property Trust supplied data and not use configuration schema on save.
ConfigEntityBase::$uuid protected property The UUID for this entity.
ConfigEntityBase::$_core protected property Information maintained by Drupal core about configuration.
ConfigEntityBase::addDependency protected function Overrides \Drupal\Core\Entity\DependencyTrait:addDependency().
ConfigEntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityBase::createDuplicate 1
ConfigEntityBase::disable public function Disables the configuration entity. Overrides ConfigEntityInterface::disable 1
ConfigEntityBase::enable public function Enables the configuration entity. Overrides ConfigEntityInterface::enable
ConfigEntityBase::get public function Returns the value of a property. Overrides ConfigEntityInterface::get
ConfigEntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityBase::getCacheTagsToInvalidate 1
ConfigEntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityBase::getConfigDependencyName
ConfigEntityBase::getConfigManager protected static function Gets the configuration manager.
ConfigEntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityBase::getConfigTarget
ConfigEntityBase::getDependencies public function Gets the configuration dependencies. Overrides ConfigEntityInterface::getDependencies
ConfigEntityBase::getOriginalId public function Gets the original ID. Overrides EntityBase::getOriginalId
ConfigEntityBase::getThirdPartyProviders public function Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface::getThirdPartyProviders
ConfigEntityBase::getThirdPartySetting public function Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface::getThirdPartySetting
ConfigEntityBase::getThirdPartySettings public function Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface::getThirdPartySettings
ConfigEntityBase::getTypedConfig protected function Gets the typed config manager.
ConfigEntityBase::hasTrustedData public function Gets whether on not the data is trusted. Overrides ConfigEntityInterface::hasTrustedData
ConfigEntityBase::invalidateTagsOnDelete protected static function Override to never invalidate the individual entities' cache tags; the config system already invalidates them. Overrides EntityBase::invalidateTagsOnDelete
ConfigEntityBase::invalidateTagsOnSave protected function Override to never invalidate the entity's cache tag; the config system already invalidates it. Overrides EntityBase::invalidateTagsOnSave
ConfigEntityBase::isInstallable public function Checks whether this entity is installable. Overrides ConfigEntityInterface::isInstallable 2
ConfigEntityBase::isUninstalling public function Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface::isUninstalling
ConfigEntityBase::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityBase::link
ConfigEntityBase::save public function Saves an entity permanently. Overrides EntityBase::save 1
ConfigEntityBase::set public function Sets the value of a property. Overrides ConfigEntityInterface::set
ConfigEntityBase::setOriginalId public function Sets the original ID. Overrides EntityBase::setOriginalId
ConfigEntityBase::setStatus public function Sets the status of the configuration entity. Overrides ConfigEntityInterface::setStatus
ConfigEntityBase::setThirdPartySetting public function Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface::setThirdPartySetting
ConfigEntityBase::setUninstalling public function
ConfigEntityBase::sort public static function Helper callback for uasort() to sort configuration entities by weight and label. 6
ConfigEntityBase::status public function Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface::status 4
ConfigEntityBase::toArray public function Gets an array of all property values. Overrides EntityBase::toArray 2
ConfigEntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityBase::toUrl
ConfigEntityBase::trustData public function Sets that the data should be trusted. Overrides ConfigEntityInterface::trustData
ConfigEntityBase::unsetThirdPartySetting public function Unsets a third-party setting. Overrides ThirdPartySettingsInterface::unsetThirdPartySetting
ConfigEntityBase::url public function Gets the public URL for this entity. Overrides EntityBase::url
ConfigEntityBase::urlInfo public function Gets the URL object for the entity. Overrides EntityBase::urlInfo
ConfigEntityBase::__construct public function Constructs an Entity object. Overrides EntityBase::__construct 10
ConfigEntityBase::__sleep public function Overrides EntityBase::__sleep 4
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency. Aliased as: addDependencyTrait
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::access public function Checks data value access. Overrides AccessibleInterface::access 1
EntityBase::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 2
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityManager Deprecated protected function Gets the entity manager.
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::id public function Gets the identifier. Overrides EntityInterface::id 11
EntityBase::label public function Gets the label of the entity. Overrides EntityInterface::label 6
EntityBase::language public function Gets the language of the entity. Overrides EntityInterface::language 1
EntityBase::languageManager protected function Gets the language manager.
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
EntityBase::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete 16
EntityBase::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 5
EntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::urlRouteParameters protected function Gets an array of placeholders for this entity. 2
EntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
EntityBase::uuidGenerator protected function Gets the UUID generator.
InstallingTrait::isInstallingFromExtension protected function Determines if this config entity is being installed from an extension.
InstallingTrait::isNew abstract public function Determines whether the entity is new.
LoggerTrait::$logger protected property The logging channel to use.
LoggerTrait::getLogger public function Retrieves the logger.
LoggerTrait::logException protected function Logs an exception.
LoggerTrait::setLogger public function Sets the logger.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 1
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
Server::$backend protected property The ID of the backend plugin.
Server::$backendPlugin protected property The backend plugin instance.
Server::$backend_config protected property The backend plugin configuration.
Server::$description protected property The displayed description of the server.
Server::$features protected property The features this server supports.
Server::$id protected property The ID of the server.
Server::$name protected property The displayed name of the server.
Server::addIndex public function Adds a new index to this server. Overrides BackendSpecificInterface::addIndex
Server::calculateDependencies public function Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityBase::calculateDependencies
Server::deleteAllIndexItems public function Deletes all the items from the index. Overrides BackendSpecificInterface::deleteAllIndexItems
Server::deleteAllItems public function Deletes all items on this server, except those from read-only indexes. Overrides ServerInterface::deleteAllItems
Server::deleteItems public function Deletes the specified items from the index. Overrides BackendSpecificInterface::deleteItems
Server::getBackend public function Retrieves the backend. Overrides ServerInterface::getBackend
Server::getBackendConfig public function Retrieves the configuration of this server's backend plugin. Overrides ServerInterface::getBackendConfig
Server::getBackendDefinedFields public function Provides information on additional fields made available by the backend. Overrides BackendSpecificInterface::getBackendDefinedFields
Server::getBackendId public function Retrieves the plugin ID of the backend of this server. Overrides ServerInterface::getBackendId
Server::getDescription public function Retrieves the server's description. Overrides ServerInterface::getDescription
Server::getDiscouragedProcessors public function Limits the processors displayed in the UI for indexes on this server. Overrides BackendSpecificInterface::getDiscouragedProcessors
Server::getIndexes public function Retrieves a list of indexes which use this server. Overrides ServerInterface::getIndexes
Server::getSupportedFeatures public function Returns all features that this backend supports. Overrides BackendSpecificInterface::getSupportedFeatures
Server::hasValidBackend public function Determines whether the backend is valid. Overrides ServerInterface::hasValidBackend
Server::indexItems public function Indexes the specified items. Overrides BackendSpecificInterface::indexItems
Server::isAvailable public function Returns a boolean with the availability of the backend. Overrides BackendSpecificInterface::isAvailable
Server::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityBase::onDependencyRemoval
Server::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityBase::postSave
Server::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides ConfigEntityBase::preDelete
Server::preSave public function Acts on an entity before the presave hook is invoked. Overrides ConfigEntityBase::preSave
Server::removeIndex public function Removes an index from this server. Overrides BackendSpecificInterface::removeIndex
Server::search public function Executes a search on this server. Overrides BackendSpecificInterface::search
Server::setBackendConfig public function Sets the configuration of this server's backend plugin. Overrides ServerInterface::setBackendConfig
Server::supportsDataType public function Determines whether the backend supports a given add-on data type. Overrides BackendSpecificInterface::supportsDataType
Server::supportsFeature public function Determines whether this server supports a given feature. Overrides ServerInterface::supportsFeature
Server::updateIndex public function Notifies the server that an index attached to it has been changed. Overrides BackendSpecificInterface::updateIndex
Server::viewSettings public function Returns additional, backend-specific information about this server. Overrides BackendSpecificInterface::viewSettings
Server::__clone public function Implements the magic __clone() method.
SynchronizableEntityTrait::$isSyncing protected property Whether this entity is being created, updated or deleted through a synchronization process.
SynchronizableEntityTrait::isSyncing public function
SynchronizableEntityTrait::setSyncing public function