src/Controller/API/DescubrirBaController.php line 193

Open in your IDE?
  1. <?php
  2. namespace App\Controller\API;
  3. use App\Controller\BaseController;
  4. use App\Entity\Log\LogInteraction;
  5. use App\Services\API\DescubrirBaService;
  6. use App\Utils\APIResponse;
  7. use App\Utils\CommonFunctions;
  8. use Exception;
  9. use OpenApi\Annotations as OA;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\Routing\Annotation\Route;
  13. /**
  14.  * @Route("/descubrir-ba")
  15.  */
  16. class DescubrirBaController extends BaseController
  17. {
  18.     /**
  19.      * @Route("/al-aire-libre", name="get_descubrir_ba_al_aire_libre", methods={"GET"})
  20.      * @param Request $request
  21.      * @param DescubrirBaService $descubrirBaService
  22.      * @return Response
  23.      *
  24.      * @OA\Get(
  25.      *     path="/api/v1/descubrir-ba/al-aire-libre",
  26.      *     summary="Obtener eventos del agrupador 'Al aire Libre'",
  27.      *     @OA\Response(
  28.      *         response=200,
  29.      *         description="Response",
  30.      *         @OA\MediaType(
  31.      *             mediaType="application/json",
  32.      *             @OA\Schema(
  33.      *                 @OA\Property(property="status", type="integer"),
  34.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  35.      *                 @OA\Property(property="content", type="object")
  36.      *            )
  37.      *        )
  38.      *    )
  39.      * )
  40.      */
  41.     public function getEventosAlAireLibreAction(Request $requestDescubrirBaService $descubrirBaService)
  42.     {
  43.         $statusCode APIResponse::$SUCCESS;
  44.         $status APIResponse::$SUCCESS;
  45.         $errors = array();
  46.         $result null;
  47.         try {
  48.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_AL_AIRE_LIBRE');
  49.             $endpointAgrupador CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_AL_AIRE_LIBRE');
  50.             $result $descubrirBaService->getEventosByAgrupador($nombreAgrupador$endpointAgrupador);
  51.         } catch (Exception $e) {
  52.             $statusCode APIResponse::$INTERNAL_ERROR;
  53.             $status APIResponse::$INTERNAL_ERROR;
  54.             $errors = array($e->getMessage());
  55.             $errorInfo CommonFunctions::getErrorException($e);
  56.             $this->logInteractionService->addErrorLog(
  57.                 LogInteraction::$LIST,
  58.                 CommonFunctions::getClassMethod(__METHOD__),
  59.                 $e->getMessage(),
  60.                 $errorInfo
  61.             );
  62.         }
  63.         return $this->generateJsonResponse($result$statusCode$status$errors);
  64.     }
  65.     /**
  66.      * @Route("/ciudad-como-escenario", name="get_descubrir_ba_ciudad_escenario", methods={"GET"})
  67.      * @param Request $request
  68.      * @param DescubrirBaService $descubrirBaService
  69.      * @return Response
  70.      *
  71.      * @OA\Get(
  72.      *     path="/api/v1/descubrir-ba/ciudad-como-escenario",
  73.      *     summary="Obtener eventos del agrupador 'Ciudad como escenario'",
  74.      *     @OA\Response(
  75.      *         response=200,
  76.      *         description="Response",
  77.      *         @OA\MediaType(
  78.      *             mediaType="application/json",
  79.      *             @OA\Schema(
  80.      *                 @OA\Property(property="status", type="integer"),
  81.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  82.      *                 @OA\Property(property="content", type="object")
  83.      *            )
  84.      *        )
  85.      *    )
  86.      * )
  87.      */
  88.     public function ciudadComoEscenarioAction(Request $requestDescubrirBaService $descubrirBaService)
  89.     {
  90.         $statusCode APIResponse::$SUCCESS;
  91.         $status APIResponse::$SUCCESS;
  92.         $errors = array();
  93.         $result null;
  94.         try {
  95.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_CIUDAD_ESCENARIO');
  96.             $endpointAgrupador CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_CIUDAD_COMO_ESCENARIO');
  97.             $result $descubrirBaService->getEventosByAgrupador($nombreAgrupador$endpointAgrupadorfalse);
  98.         } catch (Exception $e) {
  99.             $statusCode APIResponse::$INTERNAL_ERROR;
  100.             $status APIResponse::$INTERNAL_ERROR;
  101.             $errors = array($e->getMessage());
  102.             $errorInfo CommonFunctions::getErrorException($e);
  103.             $this->logInteractionService->addErrorLog(
  104.                 LogInteraction::$LIST,
  105.                 CommonFunctions::getClassMethod(__METHOD__),
  106.                 $e->getMessage(),
  107.                 $errorInfo
  108.             );
  109.         }
  110.         return $this->generateJsonResponse($result$statusCode$status$errors);
  111.     }
  112.     /**
  113.      * @Route("/destacado", name="get_descubrir_ba_destacado", methods={"GET"})
  114.      * @param Request $request
  115.      * @param DescubrirBaService $descubrirBaService
  116.      * @return Response
  117.      *
  118.      * @OA\Get(
  119.      *     path="/api/v1/descubrir-ba/destacado",
  120.      *     summary="Obtener eventos del agrupador 'Destacado'",
  121.      *     @OA\Response(
  122.      *         response=200,
  123.      *         description="Response",
  124.      *         @OA\MediaType(
  125.      *             mediaType="application/json",
  126.      *             @OA\Schema(
  127.      *                 @OA\Property(property="status", type="integer"),
  128.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  129.      *                 @OA\Property(property="content", type="object")
  130.      *            )
  131.      *        )
  132.      *    )
  133.      * )
  134.      */
  135.     public function getEventosDestacadoAction(Request $requestDescubrirBaService $descubrirBaService)
  136.     {
  137.         $statusCode APIResponse::$SUCCESS;
  138.         $status APIResponse::$SUCCESS;
  139.         $errors = array();
  140.         $result null;
  141.         try {
  142.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_DESTACADO');
  143.             $result $descubrirBaService->getEventosByAgrupador($nombreAgrupador);
  144.         } catch (Exception $e) {
  145.             $statusCode APIResponse::$INTERNAL_ERROR;
  146.             $status APIResponse::$INTERNAL_ERROR;
  147.             $errors = array($e->getMessage());
  148.             $errorInfo CommonFunctions::getErrorException($e);
  149.             $this->logInteractionService->addErrorLog(
  150.                 LogInteraction::$LIST,
  151.                 CommonFunctions::getClassMethod(__METHOD__),
  152.                 $e->getMessage(),
  153.                 $errorInfo
  154.             );
  155.         }
  156.         return $this->generateJsonResponse($result$statusCode$status$errors);
  157.     }
  158.     /**
  159.      * @Route("/destacados-carrusel", name="get_descubrir_ba_destacados_carrusel", methods={"GET"})
  160.      * @param Request $request
  161.      * @param DescubrirBaService $descubrirBaService
  162.      * @return Response
  163.      *
  164.      * @OA\Get(
  165.      *     path="/api/v1/descubrir-ba/destacados-carrusel",
  166.      *     summary="Obtener eventos del agrupador 'Destacados Carrusel'",
  167.      *     @OA\Response(
  168.      *         response=200,
  169.      *         description="Response",
  170.      *         @OA\MediaType(
  171.      *             mediaType="application/json",
  172.      *             @OA\Schema(
  173.      *                 @OA\Property(property="status", type="integer"),
  174.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  175.      *                 @OA\Property(property="content", type="object")
  176.      *            )
  177.      *        )
  178.      *    )
  179.      * )
  180.      */
  181.     public function getEventosDestacadosCarruselAction(Request $requestDescubrirBaService $descubrirBaService)
  182.     {
  183.         $statusCode APIResponse::$SUCCESS;
  184.         $status APIResponse::$SUCCESS;
  185.         $errors = array();
  186.         $result null;
  187.         try {
  188.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_DESTACADOS_CARRUSEL');
  189.             $result $descubrirBaService->getEventosByAgrupador($nombreAgrupador);
  190.         } catch (Exception $e) {
  191.             $statusCode APIResponse::$INTERNAL_ERROR;
  192.             $status APIResponse::$INTERNAL_ERROR;
  193.             $errors = array($e->getMessage());
  194.             $errorInfo CommonFunctions::getErrorException($e);
  195.             $this->logInteractionService->addErrorLog(
  196.                 LogInteraction::$LIST,
  197.                 CommonFunctions::getClassMethod(__METHOD__),
  198.                 $e->getMessage(),
  199.                 $errorInfo
  200.             );
  201.         }
  202.         return $this->generateJsonResponse($result$statusCode$status$errors);
  203.     }
  204.     /**
  205.      * @Route("/eventos-especiales", name="get_descubrir_ba_eventos_especiales", methods={"GET"})
  206.      * @param Request $request
  207.      * @param DescubrirBaService $descubrirBaService
  208.      * @return Response
  209.      *
  210.      * @OA\Get(
  211.      *     path="/api/v1/descubrir-ba/eventos-especiales",
  212.      *     summary="Obtener eventos del agrupador 'Eventos Especiales'",
  213.      *     @OA\Response(
  214.      *         response=200,
  215.      *         description="Response",
  216.      *         @OA\MediaType(
  217.      *             mediaType="application/json",
  218.      *             @OA\Schema(
  219.      *                 @OA\Property(property="status", type="integer"),
  220.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  221.      *                 @OA\Property(property="content", type="object")
  222.      *            )
  223.      *        )
  224.      *    )
  225.      * )
  226.      */
  227.     public function getEventosEspecialesAction(Request $requestDescubrirBaService $descubrirBaService)
  228.     {
  229.         $statusCode APIResponse::$SUCCESS;
  230.         $status APIResponse::$SUCCESS;
  231.         $errors = array();
  232.         $result null;
  233.         try {
  234.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_EVENTOS_ESPECIALES');
  235.             $endpointAgrupador CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_EVENTOS_ESPECIALES');
  236.             $result $descubrirBaService->getEventosByAgrupador($nombreAgrupador$endpointAgrupador);
  237.         } catch (Exception $e) {
  238.             $statusCode APIResponse::$INTERNAL_ERROR;
  239.             $status APIResponse::$INTERNAL_ERROR;
  240.             $errors = array($e->getMessage());
  241.             $errorInfo CommonFunctions::getErrorException($e);
  242.             $this->logInteractionService->addErrorLog(
  243.                 LogInteraction::$LIST,
  244.                 CommonFunctions::getClassMethod(__METHOD__),
  245.                 $e->getMessage(),
  246.                 $errorInfo
  247.             );
  248.         }
  249.         return $this->generateJsonResponse($result$statusCode$status$errors);
  250.     }
  251.     /**
  252.      * @Route("/eventos-propios", name="get_descubrir_ba_eventos_propios", methods={"GET"})
  253.      * @param Request $request
  254.      * @param DescubrirBaService $descubrirBaService
  255.      * @return Response
  256.      *
  257.      * @OA\Get(
  258.      *     path="/api/v1/descubrir-ba/eventos-propios",
  259.      *     summary="Obtener eventos del agrupador 'Eventos propios'",
  260.      *     @OA\Response(
  261.      *         response=200,
  262.      *         description="Response",
  263.      *         @OA\MediaType(
  264.      *             mediaType="application/json",
  265.      *             @OA\Schema(
  266.      *                 @OA\Property(property="status", type="integer"),
  267.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  268.      *                 @OA\Property(property="content", type="object")
  269.      *            )
  270.      *        )
  271.      *    )
  272.      * )
  273.      */
  274.     public function getEventosPropiosAction(Request $requestDescubrirBaService $descubrirBaService)
  275.     {
  276.         $statusCode APIResponse::$SUCCESS;
  277.         $status APIResponse::$SUCCESS;
  278.         $errors = array();
  279.         $result null;
  280.         try {
  281.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_EVENTOS_PROPIOS');
  282.             $endpointAgrupador CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_EVENTOS_PROPIOS');
  283.             $result $descubrirBaService->getEventosByAgrupador($nombreAgrupador$endpointAgrupador);
  284.         } catch (Exception $e) {
  285.             $statusCode APIResponse::$INTERNAL_ERROR;
  286.             $status APIResponse::$INTERNAL_ERROR;
  287.             $errors = array($e->getMessage());
  288.             $errorInfo CommonFunctions::getErrorException($e);
  289.             $this->logInteractionService->addErrorLog(
  290.                 LogInteraction::$LIST,
  291.                 CommonFunctions::getClassMethod(__METHOD__),
  292.                 $e->getMessage(),
  293.                 $errorInfo
  294.             );
  295.         }
  296.         return $this->generateJsonResponse($result$statusCode$status$errors);
  297.     }
  298.     /**
  299.      * @Route("/revivi", name="get_descubrir_ba_revivi", methods={"GET"})
  300.      * @param Request $request
  301.      * @param DescubrirBaService $descubrirBaService
  302.      * @return Response
  303.      *
  304.      * @OA\Get(
  305.      *     path="/api/v1/descubrir-ba/revivi",
  306.      *     summary="Obtener eventos del agrupador 'RevivĂ­'",
  307.      *     @OA\Response(
  308.      *         response=200,
  309.      *         description="Response",
  310.      *         @OA\MediaType(
  311.      *             mediaType="application/json",
  312.      *             @OA\Schema(
  313.      *                 @OA\Property(property="status", type="integer"),
  314.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  315.      *                 @OA\Property(property="content", type="object")
  316.      *            )
  317.      *        )
  318.      *    )
  319.      * )
  320.      */
  321.     public function getEventosReviviAction(Request $requestDescubrirBaService $descubrirBaService)
  322.     {
  323.         $statusCode APIResponse::$SUCCESS;
  324.         $status APIResponse::$SUCCESS;
  325.         $errors = array();
  326.         $result null;
  327.         try {
  328.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_REVIVI');
  329.             $endpointAgrupador CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_REVIVI');
  330.             $result $descubrirBaService->getEventosRevivi($nombreAgrupador$endpointAgrupador);
  331.         } catch (Exception $e) {
  332.             $statusCode APIResponse::$INTERNAL_ERROR;
  333.             $status APIResponse::$INTERNAL_ERROR;
  334.             $errors = array($e->getMessage());
  335.             $errorInfo CommonFunctions::getErrorException($e);
  336.             $this->logInteractionService->addErrorLog(
  337.                 LogInteraction::$LIST,
  338.                 CommonFunctions::getClassMethod(__METHOD__),
  339.                 $e->getMessage(),
  340.                 $errorInfo
  341.             );
  342.         }
  343.         return $this->generateJsonResponse($result$statusCode$status$errors);
  344.     }
  345.     /**
  346.      * @Route("/eventos-gratuitos", name="get_descubrir_ba_eventos_gratuitos", methods={"GET"})
  347.      * @param Request $request
  348.      * @param DescubrirBaService $descubrirBaService
  349.      * @return Response
  350.      *
  351.      * @OA\Get(
  352.      *     path="/api/v1/descubrir-ba/eventos-gratuitos",
  353.      *     summary="Obtener eventos del agrupador 'Eventos Gratuitos'",
  354.      *     @OA\Response(
  355.      *         response=200,
  356.      *         description="Response",
  357.      *         @OA\MediaType(
  358.      *             mediaType="application/json",
  359.      *             @OA\Schema(
  360.      *                 @OA\Property(property="status", type="integer"),
  361.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  362.      *                 @OA\Property(property="content", type="object")
  363.      *            )
  364.      *        )
  365.      *    )
  366.      * )
  367.      */
  368.     public function getEventosGratuitosAction(Request $requestDescubrirBaService $descubrirBaService)
  369.     {
  370.         $statusCode APIResponse::$SUCCESS;
  371.         $status APIResponse::$SUCCESS;
  372.         $errors = array();
  373.         $result null;
  374.         try {
  375.             $nombreAgrupador CommonFunctions::getParameter('DESCUBRIR_BA_EVENTOS_GRATUITOS');
  376.             $endpointAgrupador CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_EVENTOS_GRATUITOS');
  377.             $result $descubrirBaService->getEventosByAgrupador($nombreAgrupador$endpointAgrupador);
  378.         } catch (Exception $e) {
  379.             $statusCode APIResponse::$INTERNAL_ERROR;
  380.             $status APIResponse::$INTERNAL_ERROR;
  381.             $errors = array($e->getMessage());
  382.             $errorInfo CommonFunctions::getErrorException($e);
  383.             $this->logInteractionService->addErrorLog(
  384.                 LogInteraction::$LIST,
  385.                 CommonFunctions::getClassMethod(__METHOD__),
  386.                 $e->getMessage(),
  387.                 $errorInfo
  388.             );
  389.         }
  390.         return $this->generateJsonResponse($result$statusCode$status$errors);
  391.     }
  392.     /**
  393.      * @Route("/agenda", name="get_descubrir_ba_agenda", methods={"GET"})
  394.      * @param Request $request
  395.      * @param DescubrirBaService $descubrirBaService
  396.      * @return Response
  397.      *
  398.      * @OA\Get(
  399.      *     path="/api/v1/descubrir-ba/agenda",
  400.      *     summary="Obtener eventos recurrentes",
  401.      *     @OA\Response(
  402.      *         response=200,
  403.      *         description="Response",
  404.      *         @OA\MediaType(
  405.      *             mediaType="application/json",
  406.      *             @OA\Schema(
  407.      *                 @OA\Property(property="status", type="integer"),
  408.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  409.      *                 @OA\Property(property="content", type="object")
  410.      *            )
  411.      *        )
  412.      *    )
  413.      * )
  414.      */
  415.     public function getEventosAgendasAction(Request $requestDescubrirBaService $descubrirBaService)
  416.     {
  417.         $statusCode APIResponse::$SUCCESS;
  418.         $status APIResponse::$SUCCESS;
  419.         $errors = array();
  420.         $result null;
  421.         try {
  422.             $endpointAgrupador CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_AGENDA');
  423.             $result $descubrirBaService->getEventosAgendas($endpointAgrupador);
  424.         } catch (Exception $e) {
  425.             $statusCode APIResponse::$INTERNAL_ERROR;
  426.             $status APIResponse::$INTERNAL_ERROR;
  427.             $errors = array($e->getMessage());
  428.             $errorInfo CommonFunctions::getErrorException($e);
  429.             $this->logInteractionService->addErrorLog(
  430.                 LogInteraction::$LIST,
  431.                 CommonFunctions::getClassMethod(__METHOD__),
  432.                 $e->getMessage(),
  433.                 $errorInfo
  434.             );
  435.         }
  436.         return $this->generateJsonResponse($result$statusCode$status$errors);
  437.     }
  438. }