Commit c5e23042 authored by John Erhardt's avatar John Erhardt Committed by Thomas Seiber
Browse files

Issue #3222644 by johne, drunken monkey: Made...

Issue #3222644 by johne, drunken monkey: Made ContentEntityTrackingManager::filterValidItemIds() public.
parent 829e840a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
Search API 1.x, dev (xxxx-xx-xx):
---------------------------------
- #3222644 by johne, drunken monkey: Made
  ContentEntityTrackingManager::filterValidItemIds() public.
- #3256114 by drunken monkey: Fixed wrong static method calls in
  UnsavedIndexConfiguration.
- #2869103 by osopolar, drunken monkey: Fixed problems with theme cache when
+30 −0
Original line number Diff line number Diff line
@@ -1240,6 +1240,36 @@ class ContentEntity extends DatasourcePluginBase implements PluginFormInterface
      ->getIndexesForEntity($entity);
  }

  /**
   * Filters a set of datasource-specific item IDs.
   *
   * Returns only those item IDs that are valid for the given datasource and
   * index. This method only checks the item language, though – whether an
   * entity with that ID actually exists, or whether it has a bundle included
   * for that datasource, is not verified.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The index for which to validate.
   * @param string $datasource_id
   *   The ID of the datasource on the index for which to validate.
   * @param string[] $item_ids
   *   The item IDs to be validated.
   *
   * @return string[]
   *   All given item IDs that are valid for that index and datasource.
   *
   * @deprecated in search_api:8.x-1.22 and is removed from search_api:2.0.0.
   *   Use
   *   \Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager::filterValidItemIds()
   *   instead.
   *
   * @see https://www.drupal.org/node/3257943
   */
  public static function filterValidItemIds(IndexInterface $index, $datasource_id, array $item_ids) {
    @trigger_error('\Drupal\search_api\Plugin\search_api\datasource\ContentEntity::filterValidItemIds() is deprecated in search_api:8.x-1.21 and is removed from search_api:2.0.0. Use \Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager::filterValidItemIds() instead. See https://www.drupal.org/node/3257943', E_USER_DEPRECATED);
    return ContentEntityTrackingManager::filterValidItemIds($index, $datasource_id, $item_ids);
  }

  /**
   * {@inheritdoc}
   */
+2 −2
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ class ContentEntityTrackingManager {

    foreach ($indexes as $index) {
      if ($inserted_ids) {
        $filtered_item_ids = $this->filterValidItemIds($index, $datasource_id, $inserted_ids);
        $filtered_item_ids = static::filterValidItemIds($index, $datasource_id, $inserted_ids);
        $index->trackItemsInserted($datasource_id, $filtered_item_ids);
      }
      if ($updated_ids) {
@@ -384,7 +384,7 @@ class ContentEntityTrackingManager {
   * @return string[]
   *   All given item IDs that are valid for that index and datasource.
   */
  protected function filterValidItemIds(IndexInterface $index, string $datasource_id, array $item_ids): array {
  public static function filterValidItemIds(IndexInterface $index, string $datasource_id, array $item_ids): array {
    if (!$index->isValidDatasource($datasource_id)) {
      return $item_ids;
    }