You are here

public function MessageQueueItem::getMessage in Courier 2.x

Same name and namespace in other branches
  1. 8 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

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