You are here

public function WebhooksService::loadMultipleByEvent in Webhooks 8

Load multiple WebhookConfigs by event.

Parameters

string $event: An event string in the form of entity:entity_type:action, e.g. 'entity:user:create', 'entity:user:update' or 'entity:user:delete'.

string $type: A type string, e.g. 'outgoing' or 'incoming'.

Return value

\Drupal\webhooks\Entity\WebhookConfigInterface[] An array of WebhookConfig entities.

Overrides WebhookDispatcherInterface::loadMultipleByEvent

1 call to WebhooksService::loadMultipleByEvent()
WebhooksService::triggerEvent in src/WebhooksService.php
Trigger all webhook subscriptions associated with the given event.

File

src/WebhooksService.php, line 144

Class

WebhooksService
Class WebhookService.

Namespace

Drupal\webhooks

Code

public function loadMultipleByEvent($event, $type = 'outgoing') {
  $query = $this->webhookStorage
    ->getQuery()
    ->condition('status', 1)
    ->condition('events', $event, 'CONTAINS')
    ->condition('type', $type, '=');
  $ids = $query
    ->execute();
  return $this->webhookStorage
    ->loadMultiple($ids);
}