Esempio n. 1
0
 /**
  * @param ThumbFinderRequest $request
  * @return mixed
  */
 public function findPhotoCollectionWithItsThumbsOf(ThumbFinderRequest $request)
 {
     $photoCollection = $this->photoRepository->findCollectionBy($request->resourceId());
     $collectionOfThumbCollection = new CollectionOfThumbCollection();
     foreach ($photoCollection as $photo) {
         $collectionOfThumbCollection[] = $this->getThumbsCollectionOfPhoto($request->thumbRequestCollection(), $photo);
     }
     return $this->thumbPresenter->writeCollection($photoCollection, $collectionOfThumbCollection);
 }
 /**
  * @test
  */
 public function saveUnique()
 {
     $this->persistHander->saveUnique($this->request);
     $photo = $this->repository->findOneBy(new ResourceId($this->resourceId));
     $this->assertFileExists($photo->photoFile()->filePath());
     $this->persistHander->saveUnique($this->request);
     $photo = $this->repository->findOneBy(new ResourceId($this->resourceId));
     $this->assertFileExists($photo->photoFile()->filePath());
     $this->persistHander->delete($photo->id());
 }
Esempio n. 3
0
 /**
  * @param SavePhotoRequest $request
  * @return Photo
  */
 private function createPhotoBy(SavePhotoRequest $request)
 {
     $resourceId = new ResourceId($request->resourceId());
     $photoName = new PhotoName($request->name());
     $photoFile = new PhotoFile($request->file());
     $photoId = $this->repository->ensureUniquePhotoId();
     return new Photo($photoId, $resourceId, $photoName, $this->storage->getPhotoHttpUrlBy($photoId, $resourceId, $photoName, $photoFile), new PhotoAltCollection([new PhotoAlt($photoId, $request->alt(), new Lang($request->lang()))]), new Position($request->position()), $photoFile);
 }
Esempio n. 4
0
 /**
  * @param ResourceId $resourceId
  * @return mixed
  */
 public function findPhotoCollectionOf(ResourceId $resourceId)
 {
     return $this->presenter->writeCollection($this->repository->findCollectionBy($resourceId));
 }