public function getLetter() : string { if (!strlen($this->community->getTitle())) { throw new \Exception('No title available'); } return substr($this->community->getTitle(), 0, 1); }
public function format(Community $community) { $isOwn = false; if ($this->currentAccountService->isAvailable()) { $isOwn = $this->currentAccountService->getCurrentAccount()->equals($community->getOwner()); } return ['community' => $community->toJSON(), 'collections' => $this->formatCollections($community->getCollections()), 'is_own' => $isOwn]; }
public function subscribeCommunity(Profile $profile, Community $community, $options = null) : Subscribe { $subscribe = new Subscribe(); $subscribe->setProfileId($profile->getId())->setOptions($options)->setSubscribeId($community->getId())->setSubscribeType(Subscribe::TYPE_COMMUNITY); $em = $this->getEntityManager(); $em->persist($subscribe); $em->flush(); return $subscribe; }
protected function getThemeIdsWeight(Community $entity) : array { return $this->themeWeightCalculator->calculateWeights($entity->getThemeIds()); }
public function isActivated(Community $community) : bool { return $community->getFeatures()->hasFeature($this->getCode()); }
public function unSubscribeCommunity(Profile $profile, Community $community) { $criteria = ['profileId' => $profile->getId(), 'subscribeId' => $community->getId(), 'subscribeType' => Subscribe::TYPE_COMMUNITY]; return $this->subscribeRepository->unSubscribeByCriteria($criteria); }
public function __construct(Profile $profile, Community $community) { $this->profile = $profile; $this->community = $community; $this->communitySID = $community->getSID(); }
public function deactivateFeature(Community $community, string $featureCode) { $community->getFeatures()->excludeFeature($featureCode); $this->getEntityManager()->flush([$community]); }