<?php
namespace App\Controller\Api;
use App\Entity\Config;
use App\Services\ConfigManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
class ConfigController extends ApiController
{
/** @var ConfigManager $configManager */
protected $configManager;
/**
* @param ConfigManager $configManager
*/
public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, configManager $configManager)
{
parent::__construct($em,$parameterBag);
$this->configManager = $configManager;
}
/**
* @param Request $request
* @return JsonResponse
*
* @Route("/config", name="api_config_read", methods={"POST"})
*/
public function getConfig(Request $request)
{
$response = $this->configManager->getConfig();
$this->setStatusCode($response["code"]);
return $this->response($response);
}
// protected function getDataFromRequest(Request $request){
// $data = [
// "value"=>$request->get('value'),
// ];
// return $data;
// }
}