public function leaveCommunity(int $profileId, string $communitySID)
 {
     $communityId = $this->communityRepository->getCommunityBySID($communitySID)->getId();
     if (!$this->hasBookmarks($profileId, $communityId)) {
         throw new AlreadyLeavedException(sprintf('You are not joined to this community'));
     }
     $this->profileCommunitiesRepository->leaveCommunity($profileId, $communityId);
 }
 public function deactivateFeature(string $featureStringCode, Community $community)
 {
     $feature = $this->featureFactory->createFeatureFromStringCode($featureStringCode);
     if (!$feature->isActivated($community)) {
         throw new FeatureIsNotActivatedException(sprintf('Feature `%s` is not activated for community `%d`', $featureStringCode, $community->getId()));
     }
     $feature->deactivate($community);
     $this->communityRepository->deactivateFeature($community, $featureStringCode);
 }
Esempio n. 3
0
 public function getCommunityBySID(string $communitySID) : Community
 {
     return $this->communityRepository->getCommunityBySID($communitySID);
 }