protected function RecipientHandlerSubscribersByRole::buildEntityQuery in Simplenews 8.2
Same name and namespace in other branches
- 3.x modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSubscribersByRole.php \Drupal\simplenews_demo\Plugin\simplenews\RecipientHandler\RecipientHandlerSubscribersByRole::buildEntityQuery()
Build the query that gets the list of subscribers.
Return value
\Drupal\Core\Entity\Query\QueryInterface Entity query on 'simplenews_subscriber' or 'user'.
Overrides RecipientHandlerEntityBase::buildEntityQuery
File
- modules/
simplenews_demo/ src/ Plugin/ simplenews/ RecipientHandler/ RecipientHandlerSubscribersByRole.php, line 37
Class
- RecipientHandlerSubscribersByRole
- This handler sends to all subscribers with the specified role.
Namespace
Drupal\simplenews_demo\Plugin\simplenews\RecipientHandlerCode
protected function buildEntityQuery() {
return \Drupal::entityQuery('simplenews_subscriber')
->condition('status', SubscriberInterface::ACTIVE)
->condition('subscriptions', $this
->getNewsletterId())
->condition('subscriptions.status', SIMPLENEWS_SUBSCRIPTION_STATUS_SUBSCRIBED)
->condition('uid.entity.roles', $this->configuration['role']);
}