You are here

function cacheflush_delete in CacheFlush 8

Same name and namespace in other branches
  1. 7.3 modules/cacheflush_entity/cacheflush_entity.module \cacheflush_delete()

Deletes a single entity by ID.

Parameters

mixed $id: The ID of entity to be deleted.

Throws

\Exception Throws exception if exists.

1 call to cacheflush_delete()
CacheFlushEntityTest::testCrudFunctions in modules/cacheflush_entity/tests/Functional/CacheFlushEntityTest.php
Tests CRUD functions for cacheflush entity.

File

modules/cacheflush_entity/cacheflush_entity.module, line 89
Cacheflush Entity API.

Code

function cacheflush_delete($id) {
  $controller = \Drupal::entityTypeManager()
    ->getStorage('cacheflush');
  $entities = $controller
    ->load($id);
  $entities
    ->delete();
}