public function deleteTheme(int $themeId) : Theme { $theme = $this->themeRepository->getThemeById($themeId); $this->getEventEmitter()->emit(self::EVENT_DELETE, [$theme]); $this->themeRepository->deleteTheme($themeId); $this->getEventEmitter()->emit(self::EVENT_DELETED, [$theme]); return $theme; }
public function editCommunity(int $communityId, EditCommunityParameters $parameters) : Community { $community = $this->communityRepository->getCommunityById($communityId); $community->setTitle($parameters->getTitle()); $community->setDescription($parameters->getDescription()); if ($parameters->hasThemeId()) { $community->setTheme($this->themeRepository->getThemeById($parameters->getThemeId())); } else { $community->unsetTheme(); } $this->communityRepository->saveCommunity($community); $this->getEventEmitter()->emit(self::EVENT_COMMUNITY_UPDATED, [$community]); return $community; }