You are here

class SearchApiSolrConflictingEntitiesException in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/SearchApiSolrConflictingEntitiesException.php \Drupal\search_api_solr\SearchApiSolrConflictingEntitiesException

Represents an exception that occurs in Search API Solr.

Hierarchy

Expanded class hierarchy of SearchApiSolrConflictingEntitiesException

3 files declare their use of SearchApiSolrConflictingEntitiesException
AbstractSolrEntityListBuilder.php in src/Controller/AbstractSolrEntityListBuilder.php
search_api_solr.install in ./search_api_solr.install
Install, update and uninstall functions for the Search API Solr module.
SolrConfigSetController.php in src/Controller/SolrConfigSetController.php

File

src/SearchApiSolrConflictingEntitiesException.php, line 10

Namespace

Drupal\search_api_solr
View source
class SearchApiSolrConflictingEntitiesException extends SearchApiSolrException {

  /**
   * Array with the conflicting entities.
   *
   * @var \Drupal\search_api_solr\SolrConfigInterface[]
   */
  protected $conflictingEntities = [];

  /**
   * Get the conflicting entities.
   *
   * @return \Drupal\search_api_solr\SolrConfigInterface[]
   *   Array with the conflicting entities.
   */
  public function getConflictingEntities() : array {
    return $this->conflictingEntities;
  }

  /**
   * Set the conflicting entities.
   *
   * @param \Drupal\search_api_solr\SolrConfigInterface[] $conflictingEntities
   *   Array with the conflicting entities.
   */
  public function setConflictingEntities(array $conflictingEntities) : void {
    $this->conflictingEntities = $conflictingEntities;
  }

  /**
   * {@inheritdoc}
   */
  public function __toString() {
    $conflicts = '<ul>';
    foreach ($this
      ->getConflictingEntities() as $entity) {
      $link = new FormattableMarkup('<li><a href="' . $entity
        ->toUrl('collection')
        ->toString() . '">@label</a></li>', [
        '@label' => $entity
          ->label(),
      ]);
      $conflicts .= $link;
    }
    return $conflicts . '</ul>';
  }

}

Members