src/Controller/API/EstadoBannerBAXController.php line 40

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\EstadoBannerBAXService;
  6. use App\Utils\APIResponse;
  7. use App\Utils\CommonFunctions;
  8. use Exception;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\HttpFoundation\Response;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. use OpenApi\Annotations as OA;
  13. /**
  14.  * @Route("/estado_banner_bax")
  15.  */
  16. class EstadoBannerBAXController extends BaseController
  17. {
  18.     /**
  19.      * @Route("", name="get-estado_banner_bax", methods={"GET"})
  20.      * @OA\Get(
  21.      *     path="/api/v1/estado_banner_bax",
  22.      *     summary="info estado del banner de bax para ser mostrado en home y perfil",
  23.      *     @OA\Response(
  24.      *         response=200,
  25.      *         description="Response",
  26.      *         @OA\MediaType(
  27.      *             mediaType="application/json",
  28.      *             @OA\Schema(
  29.      *                 @OA\Property(property="status", type="integer"),
  30.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  31.      *                 @OA\Property(property="content", type="object")
  32.      *            )
  33.      *        )
  34.      *    )
  35.      * )
  36.      */
  37.     public function getEstadoBannerBax(EstadoBannerBAXService $estadoBannerBAXService): Response
  38.     {
  39.         $statusCode APIResponse::$SUCCESS;
  40.         $status APIResponse::$SUCCESS;
  41.         $errors = array();
  42.         $result null;
  43.         try {
  44.             $result $estadoBannerBAXService->getActivoBannerBAX();
  45.         } catch (Exception $e) {
  46.             $statusCode APIResponse::$INTERNAL_ERROR;
  47.             $status APIResponse::$INTERNAL_ERROR;
  48.             $errors = array($e->getMessage());
  49.             $errorInfo CommonFunctions::getErrorException($e);
  50.             $this->logInteractionService->addErrorLog(
  51.                 LogInteraction::$LIST,
  52.                 CommonFunctions::getClassMethod(__METHOD__),
  53.                 $e->getMessage(),
  54.                 $errorInfo
  55.             );
  56.         }
  57.         return $this->generateJsonResponse($result$statusCode$status$errors);
  58.     }
  59. }