You are here

public function AbstractSolrEntityListBuilder::getConflictingEntities in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Controller/AbstractSolrEntityListBuilder.php \Drupal\search_api_solr\Controller\AbstractSolrEntityListBuilder::getConflictingEntities()

Get all conflicting entities.

Return value

array An array of all conflicting entities.

1 call to AbstractSolrEntityListBuilder::getConflictingEntities()
AbstractSolrEntityListBuilder::getEnabledEntities in src/Controller/AbstractSolrEntityListBuilder.php
Returns a list of all enabled Solr config entities for current server.

File

src/Controller/AbstractSolrEntityListBuilder.php, line 383

Class

AbstractSolrEntityListBuilder
Provides a listing of Solr Entities.

Namespace

Drupal\search_api_solr\Controller

Code

public function getConflictingEntities(array $entities) : array {
  $conflicting_entities = [];
  $purpose_ids = [];
  foreach ($entities as $key => $entity) {
    $purpose_id = $entity
      ->getPurposeId();
    if (!in_array($purpose_id, $purpose_ids)) {
      $purpose_ids[] = $purpose_id;
    }
    else {
      $conflicting_entities[$key] = $entity;
    }
  }
  return $conflicting_entities;
}