src/Controller/View/PublisherStore/PublisherStoreController.php line 68

Open in your IDE?
  1. <?php
  2. namespace App\Controller\View\PublisherStore;
  3. use App\Entity\Project\Publisher;
  4. use App\Entity\Project\PublisherStore;
  5. use App\Repository\PublisherRepository;
  6. use App\Service\AdminEngineService;
  7. use FOS\RestBundle\View\View;
  8. use FOS\RestBundle\Controller\Annotations;
  9. use FOS\RestBundle\Controller\FOSRestController;
  10. use FOS\RestBundle\Routing\ClassResourceInterface;
  11. use FOS\RestBundle\Controller\Annotations\RouteResource;
  12. use FOS\UserBundle\Event\FilterUserResponseEvent;
  13. use FOS\UserBundle\Event\GetResponseUserEvent;
  14. use FOS\UserBundle\FOSUserEvents;
  15. use FOS\UserBundle\Event\FormEvent;
  16. use FOS\UserBundle\Model\UserInterface;
  17. use Symfony\Component\HttpFoundation\Request;
  18. use Symfony\Component\Form\FormTypeInterface;
  19. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  20. use Symfony\Component\HttpFoundation\Response;
  21. use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  22. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  23. use Symfony\Component\Security\Core\Exception\AccessDeniedException;
  24. use App\Application\Sonata\MediaBundle\Entity\Media;
  25. use App\Entity\Account\Subscription;
  26. use App\Entity\Magazine\Magazine;
  27. use App\Entity\Magazine\MagazinePage;
  28. use App\Entity\Magazine\TOC;
  29. use App\Service\SerializePageService;
  30. use Symfony\Component\Serializer\Encoder\JsonEncoder;
  31. use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
  32. use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
  33. use Symfony\Component\Serializer\Serializer;
  34. use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter;
  35. use Doctrine\Common\Annotations\AnnotationReader;
  36. use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
  37. use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
  38. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  39. use FOS\RestBundle\Controller\AbstractFOSRestController;
  40. use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
  41. use App\Application\Sonata\UserBundle\Entity\User;
  42. /**
  43.  * @Route("/view/store")
  44.  */
  45. class PublisherStoreController extends AbstractFOSRestController
  46. {
  47.     private $adminEngine;
  48.     public function __construct(AdminEngineService $adminEngine)
  49.     {
  50.         $this->adminEngine $adminEngine;
  51.     }
  52.     /**
  53.      * @Route("/{slug}", methods={"GET"})
  54.      */
  55.     public function show($slug)
  56.     {
  57.         $publisherStore $this->getDoctrine()->getRepository(PublisherStore::class)->findActiveMagInStore($slug);
  58.         if(!$publisherStore) {
  59.             return $this->json(['message' => 'Publisher store cant find'], Response::HTTP_NOT_FOUND);
  60.         }
  61.         $store $this->adminEngine->getRelatedMagazines($publisherStore);
  62.         return $this->json$storeResponse::HTTP_OK );
  63.     }
  64. }