nineinchnick\nfy\components\DbQueue::sendToSubscriptions PHP Method

sendToSubscriptions() private method

private sendToSubscriptions ( nineinchnick\nfy\components\Subscription[] $subscriptions, nineinchnick\nfy\models\DbMessage $queueMessage ) : boolean
$subscriptions nineinchnick\nfy\components\Subscription[]
$queueMessage nineinchnick\nfy\models\DbMessage
return boolean
    private function sendToSubscriptions($subscriptions, $queueMessage)
    {
        $success = true;
        foreach ($subscriptions as $subscription) {
            $subscriptionMessage = clone $queueMessage;
            $subscriptionMessage->subscription_id = $subscription->id;
            $subscriptionMessage->message_id = $queueMessage->id;
            if ($this->beforeSendSubscription($subscriptionMessage, $subscription->subscriber_id) !== true) {
                continue;
            }
            if (!$subscriptionMessage->save()) {
                Yii::error(Yii::t('app', "Failed to save message '{msg}' in queue {queue_label} for the subscription {subscription_id}.", ['msg' => $queueMessage->body, 'queue_label' => $this->label, 'subscription_id' => $subscription->id]) . ' ' . print_r($subscriptionMessage->getErrors(), true), 'nfy');
                $success = false;
            }
            $this->afterSendSubscription($subscriptionMessage, $subscription->subscriber_id);
        }
        return $success;
    }