<?php
namespace App\Controller\Api;
use App\Services\Api\DifficultyManager;
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 DifficultyController extends ApiController
{
/** @var DifficultyManager $justification */
protected $difficulty;
public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, DifficultyManager $difficultyManager)
{
parent::__construct($em, $parameterBag);
$this->difficulty = $difficultyManager;
}
/**
* @param Request $request
* @return JsonResponse
*
* @Route("/difficulty/list", name="difficulty_list", methods={"POST"})
*/
public function list(Request $request)
{
$prefixFile = $this->getParameter("app.path.difficulty");
$baseurl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
$urlImages = $baseurl . $prefixFile . "/";
$data = $this->difficulty->list($urlImages);
return $this->response($data);
}
}