You are here

function MessageQueueItem::getMessage in Courier 8

Same name and namespace in other branches
  1. 2.x src/Entity/MessageQueueItem.php \Drupal\courier\Entity\MessageQueueItem::getMessage()

Get message with a channel entity type.

Parameters

string $entity_type_id: A channel entity type ID.

Return value

\Drupal\courier\ChannelInterface|NULL A message, or NULL.

Overrides MessageQueueItemInterface::getMessage

File

src/Entity/MessageQueueItem.php, line 46

Class

MessageQueueItem
Defines a Message queue item entity.

Namespace

Drupal\courier\Entity

Code

function getMessage($entity_type_id) {
  foreach ($this
    ->getMessages() as $message) {
    if ($message
      ->getEntityTypeId() == $entity_type_id) {
      return $message;
    }
  }
  return NULL;
}