Beispiel #1
0
 /**
  * @Route("/tag/{name}", name="tag")
  * @Template("FreyrGalleryWebBundle:Tag:index.html.twig")
  * @Method("GET")
  * @param string $name
  * @return array
  */
 public function getPhotosAction($name)
 {
     $tags = explode(',', $name);
     $interactor = new GetPhotosByTags($tags, $this->get('freyr.gallery.repository.photo'));
     $photos = $interactor->execute();
     return ['photos' => $photos, 'tags' => $tags];
 }
Beispiel #2
0
 /**
  * @Route("/photos", name="api.photos.get")
  * @Method("GET")
  * @return JsonResponse
  */
 public function getPhotosAction()
 {
     /** @var MongoDBPhotoRepository $photoRepository */
     $photoRepository = $this->get('freyr.gallery.repository.photo');
     $tagsInteractor = new GetTags($photoRepository);
     $photosInteractor = new GetPhotosByTags($tagsInteractor->execute()->asArray(), $photoRepository);
     $response = $photosInteractor->execute();
     return new JsonResponse($response);
 }
Beispiel #3
0
 public function testInitialise()
 {
     $this->loadFixture(100, ['uno', 'duo', 'single', 'double', 'triple', 'octo']);
     $tags = ['uno'];
     $interactor = new GetPhotosByTags($tags, $this->repository);
     $result = $interactor->execute();
     $this->assertNotEmpty($result);
     $tags = ['ta'];
     $interactor = new GetPhotosByTags($tags, $this->repository);
     $result = $interactor->execute();
     $this->assertEmpty($result->photos);
 }