You are here

public function MissingId::onEnqueueCandidateEntity in Acquia Content Hub 8.2

Skips entities that are missing ids.

Parameters

\Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent $event: The event to determine entity eligibility.

Throws

\Exception

File

modules/acquia_contenthub_publisher/src/EventSubscriber/EnqueueEligibility/MissingId.php, line 34

Class

MissingId
Any entity that is missing its id shouldn't be enqueued.

Namespace

Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility

Code

public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {
  $entity = $event
    ->getEntity();
  if (empty($entity
    ->id())) {
    $event
      ->setEligibility(FALSE);
    $event
      ->stopPropagation();
  }
}