<?php
namespace App\Controller\Api;
use App\Entity\MembershipDesc;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class MembershipDescController extends ApiController
{
/**
* @param Request $request
* @return JsonResponse
*
* @Route("/membership_desc/list/{language}", name="api_membership_desc_list", methods={"POST"})
*/
public function listMembershipDesc($language,Request $request)
{
$prefixFile = $this->getParameter("app.path.membership_images");
$baseurl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
/** @var MembershipDesc $membershipdesc */
$membershipsDesc = [];
foreach ($this->em->getRepository(MembershipDesc::class)->findAll() as $membershipDesc){
$membershipsDesc[] = $membershipDesc->__toArray($baseurl . $prefixFile . "/");
}
return $this->response($membershipsDesc);
}
}