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