6
6
7
7
use Alchemy \AuthBundle \Repository \UserRepository ;
8
8
use Alchemy \NotifyBundle \Message \AddTopicSubscribers ;
9
+ use Alchemy \NotifyBundle \Message \NotifyTopic ;
10
+ use Alchemy \NotifyBundle \Message \RemoveTopicSubscribers ;
9
11
use Alchemy \NotifyBundle \Message \UpdateSubscribers ;
10
12
use Alchemy \NotifyBundle \Service \NovuClient ;
11
13
use Psr \Log \LoggerAwareInterface ;
@@ -73,12 +75,16 @@ public function notifyTopic(
73
75
if ($ this ->notifyAuthor ) {
74
76
$ authorId = null ;
75
77
}
76
- $ this ->novuClient -> notifyTopic ( $ topicKey , $ authorId , $ notificationId , $ parameters , $ options );
78
+ $ this ->bus -> dispatch ( new NotifyTopic ( $ topicKey , $ authorId , $ notificationId , $ parameters , $ options) );
77
79
}
78
80
79
- public function addTopicSubscribers (string $ topicKey , array $ subscribers ): void
81
+ public function addTopicSubscribers (string $ topicKey , array $ subscribers, bool $ direct = false ): void
80
82
{
81
- $ this ->bus ->dispatch (new AddTopicSubscribers ($ topicKey , $ subscribers ));
83
+ if ($ direct ) {
84
+ $ this ->novuClient ->addTopicSubscribers ($ topicKey , $ subscribers );
85
+ } else {
86
+ $ this ->bus ->dispatch (new AddTopicSubscribers ($ topicKey , $ subscribers ));
87
+ }
82
88
$ this ->bus ->dispatch (new UpdateSubscribers ($ subscribers ));
83
89
}
84
90
@@ -89,7 +95,7 @@ public function createTopic(string $topicKey): void
89
95
90
96
public function removeTopicSubscribers (string $ topicKey , array $ subscribers ): void
91
97
{
92
- $ this ->novuClient -> removeTopicSubscribers ( $ topicKey , $ subscribers );
98
+ $ this ->bus -> dispatch ( new RemoveTopicSubscribers ( $ topicKey , $ subscribers) );
93
99
}
94
100
95
101
public function getTopicSubscriptions (array $ topicKeys , string $ userId ): array
0 commit comments