You are here

public function AbstractSolrEntityController::disableOnServer in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Controller/AbstractSolrEntityController.php \Drupal\search_api_solr\Controller\AbstractSolrEntityController::disableOnServer()

Disables a Solr Entity on this server.

Parameters

\Drupal\search_api\ServerInterface $search_api_server: Search API server.

\Drupal\search_api_solr\SolrConfigInterface $solr_entity: Solr entity.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Redirect response.

Throws

\Drupal\Core\Entity\EntityMalformedException

\Drupal\Core\Entity\EntityStorageException

4 calls to AbstractSolrEntityController::disableOnServer()
SolrCacheController::disableOnServer in src/Controller/SolrCacheController.php
Disables a Solr Entity on this server.
SolrFieldTypeController::disableOnServer in src/Controller/SolrFieldTypeController.php
Disables a Solr Entity on this server.
SolrRequestDispatcherController::disableOnServer in src/Controller/SolrRequestDispatcherController.php
Disables a Solr Entity on this server.
SolrRequestHandlerController::disableOnServer in src/Controller/SolrRequestHandlerController.php
Disables a Solr Entity on this server.
4 methods override AbstractSolrEntityController::disableOnServer()
SolrCacheController::disableOnServer in src/Controller/SolrCacheController.php
Disables a Solr Entity on this server.
SolrFieldTypeController::disableOnServer in src/Controller/SolrFieldTypeController.php
Disables a Solr Entity on this server.
SolrRequestDispatcherController::disableOnServer in src/Controller/SolrRequestDispatcherController.php
Disables a Solr Entity on this server.
SolrRequestHandlerController::disableOnServer in src/Controller/SolrRequestHandlerController.php
Disables a Solr Entity on this server.

File

src/Controller/AbstractSolrEntityController.php, line 99

Class

AbstractSolrEntityController
Provides different listings of Solr Entities.

Namespace

Drupal\search_api_solr\Controller

Code

public function disableOnServer(ServerInterface $search_api_server, SolrConfigInterface $solr_entity) {
  $disabled_key = $solr_entity
    ->getEntityType()
    ->getKey('disabled');
  $backend_config = $search_api_server
    ->getBackendConfig();
  $backend_config[$disabled_key][] = $solr_entity
    ->id();
  $backend_config[$disabled_key] = array_unique($backend_config[$disabled_key]);
  $search_api_server
    ->setBackendConfig($backend_config);
  $search_api_server
    ->save();
  return new RedirectResponse($solr_entity
    ->toUrl('collection')
    ->toString());
}