src/Model/PushNotificationModel.php
public function sendByType(int $typeId, string $msg, ?string $dest = null, bool $flush = false) : void
    {
        $msg = $this->composeMsg($msg, $dest);

        $subscriptions = $this->subscriptionTable->findAll()
            ->where('subscription.active', 1)
            ->where('user.active', 1)
            ->where('user:user_subscription_type.subscription_type_id', $typeId);

        foreach ($subscriptions as $row)
        {
            $this->sendNotification($row, $msg, false);
        }

        if ($flush)
        {
            $this->flush();
        }
    }
public function sendByType(int $typeId, string $msg, ?string $dest = null, bool $flush = false) : void
    {
        $msg = $this->composeMsg($msg, $dest);

        $subscriptions = $this->subscriptionTable->findAll()
            ->where('subscription.active', 1)
            ->where('user.active', 1)
            ->where('user:user_subscription_type.subscription_type_id', $typeId);

        foreach ($subscriptions as $row)
        {
            $this->sendNotification($row, $msg, false);
        }

        if ($flush)
        {
            $this->flush();
        }
    }
public function sendByType ( int $ typeId , string $ msg , ? string $ dest = null , bool $ flush = false ) : void { $ msg = $ this -> composeMsg ( $ msg , $ dest ) ; $ subscriptions = $ this -> subscriptionTable -> findAll ( ) -> where ( 'subscription.active' , 1 ) -> where ( 'user.active' , 1 ) -> where ( 'user:user_subscription_type.subscription_type_id' , $ typeId ) ; foreach ( $ subscriptions as $ row ) { $ this -> sendNotification ( $ row , $ msg , false ) ; } if ( $ flush ) { $ this -> flush ( ) ; } }
Send notification to all users subscribed to specific type.
@param int $typeId
@param string $msg
@param string $dest
@param bool $flush
Send notification to all users subscribed to specific type .