class MissingId in Acquia Content Hub 8.2
Any entity that is missing its id shouldn't be enqueued.
@package Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility
Hierarchy
- class \Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility\MissingId implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of MissingId
1 string reference to 'MissingId'
- acquia_contenthub_publisher.services.yml in modules/
acquia_contenthub_publisher/ acquia_contenthub_publisher.services.yml - modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
1 service uses MissingId
- missing_id.enqueue in modules/
acquia_contenthub_publisher/ acquia_contenthub_publisher.services.yml - Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibility\MissingId
File
- modules/
acquia_contenthub_publisher/ src/ EventSubscriber/ EnqueueEligibility/ MissingId.php, line 14
Namespace
Drupal\acquia_contenthub_publisher\EventSubscriber\EnqueueEligibilityView source
class MissingId implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ContentHubPublisherEvents::ENQUEUE_CANDIDATE_ENTITY][] = [
'onEnqueueCandidateEntity',
999,
];
return $events;
}
/**
* Skips entities that are missing ids.
*
* @param \Drupal\acquia_contenthub_publisher\Event\ContentHubEntityEligibilityEvent $event
* The event to determine entity eligibility.
*
* @throws \Exception
*/
public function onEnqueueCandidateEntity(ContentHubEntityEligibilityEvent $event) {
$entity = $event
->getEntity();
if (empty($entity
->id())) {
$event
->setEligibility(FALSE);
$event
->stopPropagation();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MissingId:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
MissingId:: |
public | function | Skips entities that are missing ids. |