You are here

public function OgDeleteOrphansBase::register in Organic groups 8

Registers a soon to be deleted group entity, for processing.

During processing its orphaned members or content will be deleted.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The group entity to register.

Overrides OgDeleteOrphansInterface::register

1 call to OgDeleteOrphansBase::register()
Simple::register in src/Plugin/OgDeleteOrphans/Simple.php
Registers a soon to be deleted group entity, for processing.
1 method overrides OgDeleteOrphansBase::register()
Simple::register in src/Plugin/OgDeleteOrphans/Simple.php
Registers a soon to be deleted group entity, for processing.

File

src/OgDeleteOrphansBase.php, line 95

Class

OgDeleteOrphansBase
Base implementation for OgDeleteOrphans plugins.

Namespace

Drupal\og

Code

public function register(EntityInterface $entity) {
  foreach ($this
    ->query($entity) as $entity_type => $orphans) {
    foreach ($orphans as $orphan) {
      $this
        ->getQueue()
        ->createItem([
        'type' => $entity_type,
        'id' => $orphan,
      ]);
    }
  }
}