public static function SavedSearch::postDelete in Search API Saved Searches 8
Acts on deleted entities before the delete hook is invoked.
Used after the entities are deleted but before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides EntityBase::postDelete
File
- src/
Entity/ SavedSearch.php, line 439
Class
- SavedSearch
- Provides an entity type for saved searches.
Namespace
Drupal\search_api_saved_searches\EntityCode
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
// Remove any "known results" we have for the deleted searches.
// NB: $entities is not documented to be keyed by entity ID, but since Core
// relies on it (see \Drupal\comment\Entity\Comment::postDelete()), we
// should be able to do the same.
\Drupal::database()
->delete('search_api_saved_searches_old_results')
->condition('search_id', array_keys($entities), 'IN')
->execute();
}