<?php
namespace App\Controller\Api;
use App\Entity\TypeSoccer;
use App\Services\Api\TypeSoccerManager;
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 TypeSoccerController extends ApiController
{
/** @var TypeSoccerManager $typeSoccerManager */
protected $typeSoccerManager;
/**
* @param TypeSoccerManager $typeSoccerManager
*/
public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, TypeSoccerManager $typeSoccerManager)
{
parent::__construct($em, $parameterBag);
$this->typeSoccerManager = $typeSoccerManager;
}
/**
* @param Request $request
* @return JsonResponse
*
* @Route("/type_soccer/list", name="api_type_soccer_list", methods={"POST"})
*/
public function listTypeSoccer()
{
$typeSoccers = [];
foreach ($this->em->getRepository(TypeSoccer::class)->findAll() as $key => $typeSoccer) {
$typeSoccers[] = $typeSoccer->__toArrayByTactics();
}
return $this->response($typeSoccers);
}
}