You are here

public static function Pool::preDelete in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/Entity/Pool.php \Drupal\cms_content_sync\Entity\Pool::preDelete()
  2. 2.0.x src/Entity/Pool.php \Drupal\cms_content_sync\Entity\Pool::preDelete()

Acts on entities before they are deleted and before hooks are invoked.

Used before the entities are deleted and 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 ConfigEntityBase::preDelete

File

src/Entity/Pool.php, line 132

Class

Pool
Defines the "Content Sync - Pool" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public static function preDelete(EntityStorageInterface $storage, array $entities) {
  parent::preDelete($storage, $entities);
  try {
    foreach ($entities as $entity) {
      $handler = new SyncCorePoolExport($entity);

      // $handler->remove(FALSE);
    }
  } catch (RequestException $e) {
    $messenger = \Drupal::messenger();
    $messenger
      ->addError(t('The Sync Core server could not be accessed. Please check the connection.'));
    throw new AccessDeniedHttpException();
  }
}