<?php
namespace App\Controller\Api;
use App\Services\Api\CompetitionManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class CompetitionController extends ApiController
{
/** @var CompetitionManager $justification */
protected $competition;
public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, CompetitionManager $competitionManager)
{
parent::__construct($em, $parameterBag);
$this->competition = $competitionManager;
}
/**
* @param Request $request
* @return JsonResponse
*
* @Route("/competition/list", name="competition_list", methods={"POST"})
*/
public function list(Request $request)
{
$prefixFile = $this->getParameter("app.path.competition_images");
$baseurl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
$urlImages = $baseurl . $prefixFile . "/";
$data = $this->competition->list($urlImages);
return $this->response($data);
}
}