示例#1
0
 public function createCommunity(CreateCommunityParameters $parameters) : Community
 {
     $owner = $this->currentAccountService->getCurrentAccount();
     $entity = new Community($owner, $parameters->getTitle(), $parameters->getDescription(), $parameters->hasThemeId() ? $this->themeRepository->getThemeById($parameters->getThemeId()) : null);
     $this->communityRepository->createCommunity($entity);
     $strategy = new CommunityImageStrategy($entity, $this->imageFileSystem, $this->wwwImageDir);
     $this->avatarService->generateImage($strategy);
     $this->backdropService->backdropPreset($entity, $this->backdropPresetFactory, $this->backdropPresetFactory->getListIds()[array_rand($this->backdropPresetFactory->getListIds())]);
     $this->communityRepository->saveCommunity($entity);
     $this->getEventEmitter()->emit(self::EVENT_COMMUNITY_CREATED, [$entity]);
     return $entity;
 }
示例#2
0
 private function generateProfileImage(int $profileId) : ImageCollection
 {
     $profile = $this->getProfileById($profileId);
     $strategy = new ProfileImageStrategy($profile, $this->imagesFlySystem, $this->wwwImagesDir);
     $this->avatarService->generateImage($strategy);
     $this->profileRepository->saveProfile($profile);
     return $profile->getImages();
 }
示例#3
0
 public function generateImage(int $collectionId) : ImageCollection
 {
     $collection = $this->collectionRepository->getCollectionById($collectionId);
     $this->getEventEmitter()->emit(self::EVENT_COLLECTION_ACCESS, [$collection]);
     $this->avatarService->generateImage(new CollectionImageStrategy($collection, $this->images, $this->wwwImagesDir));
     $this->collectionRepository->saveCollection($collection);
     $this->getEventEmitter()->emit(self::EVENT_COLLECTION_IMAGE_GENERATED, [$collection]);
     return $collection->getImages();
 }