@@ -1867,8 +1867,8 @@ protected function createTopic(Topic $resource): void
18671867 protected function createSubscriber (Subscriber $ resource ): void
18681868 {
18691869 $ target = match ($ resource ->getProviderType ()) {
1870- 'push ' => $ this ->database ->getDocument ('targets ' , $ resource ->getTargetId ()),
1871- 'email ' , 'sms ' => $ this ->database ->findOne ('targets ' , [
1870+ 'push ' => $ this ->dbForProject ->getDocument ('targets ' , $ resource ->getTargetId ()),
1871+ 'email ' , 'sms ' => $ this ->dbForProject ->findOne ('targets ' , [
18721872 Query::equal ('userId ' , [$ resource ->getUserId ()]),
18731873 Query::equal ('providerType ' , [$ resource ->getProviderType ()]),
18741874 ]),
@@ -1879,20 +1879,20 @@ protected function createSubscriber(Subscriber $resource): void
18791879 throw new \Exception ('Target not found for subscriber: ' . $ resource ->getId ());
18801880 }
18811881
1882- $ topic = $ this ->database ->getDocument ('topics ' , $ resource ->getTopicId ());
1882+ $ topic = $ this ->dbForProject ->getDocument ('topics ' , $ resource ->getTopicId ());
18831883 if ($ topic ->isEmpty ()) {
18841884 throw new \Exception ('Topic not found: ' . $ resource ->getTopicId ());
18851885 }
18861886
1887- $ user = $ this ->database ->getDocument ('users ' , $ resource ->getUserId ());
1887+ $ user = $ this ->dbForProject ->getDocument ('users ' , $ resource ->getUserId ());
18881888 if ($ user ->isEmpty ()) {
18891889 throw new \Exception ('User not found: ' . $ resource ->getUserId ());
18901890 }
18911891
18921892 $ createdAt = $ this ->normalizeDateTime ($ resource ->getCreatedAt ());
18931893 $ updatedAt = $ this ->normalizeDateTime ($ resource ->getUpdatedAt (), $ createdAt );
18941894
1895- $ this ->database ->createDocument ('subscribers ' , new UtopiaDocument ([
1895+ $ this ->dbForProject ->createDocument ('subscribers ' , new UtopiaDocument ([
18961896 '$id ' => $ resource ->getId (),
18971897 '$createdAt ' => $ createdAt ,
18981898 '$updatedAt ' => $ updatedAt ,
@@ -1922,7 +1922,7 @@ protected function createSubscriber(Subscriber $resource): void
19221922 default => throw new \Exception ('Unknown provider type: ' . $ resource ->getProviderType ()),
19231923 };
19241924
1925- $ this ->database ->increaseDocumentAttribute ('topics ' , $ resource ->getTopicId (), $ totalAttribute );
1925+ $ this ->dbForProject ->increaseDocumentAttribute ('topics ' , $ resource ->getTopicId (), $ totalAttribute );
19261926 }
19271927
19281928 /**
@@ -1961,7 +1961,7 @@ protected function createMessage(Message $resource): void
19611961 default => '' ,
19621962 };
19631963
1964- $ this ->database ->createDocument ('messages ' , new UtopiaDocument ([
1964+ $ this ->dbForProject ->createDocument ('messages ' , new UtopiaDocument ([
19651965 '$id ' => $ resource ->getId (),
19661966 '$createdAt ' => $ createdAt ,
19671967 '$updatedAt ' => $ updatedAt ,
0 commit comments