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