public function entityDelete()

in modules/quanthub_indicator/src/QuanthubIndicatorContentEntityTrackingManager.php [220:241]


  public function entityDelete(EntityInterface $entity) {
    // Check if the entity is a content entity.
    if (!($entity instanceof ContentEntityInterface)
      || !empty($entity->search_api_skip_tracking)) {
      return;
    }

    $indexes = $this->getIndexesForEntity($entity);
    if (!$indexes) {
      return;
    }

    $indicators_ids = [];
    if ($entity->getType() == 'indicator') {
      $indicators_ids = $this->getIndicatorsTrackerIds($entity);
      $datasource_id = 'entity:' . $entity->getEntityTypeId();

      foreach ($indexes as $index) {
        $index->trackItemsDeleted($datasource_id, $indicators_ids);
      }
    }
  }