<?php
namespace App\Controller\Api\Prive;
use App\Entity\Appel;
use App\Entity\Campagne;
use App\Entity\Campagneprospect;
use App\Entity\Prospect;
use App\Entity\Utilisateur;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/appel")
*/
class ApiAppelController extends ApiController
{
/**
* @Route("/find", name="api_Appel_find", methods={"POST"})
* @param Request $request
* @return JsonResponse
*/
public function find(Request $request)
{
$data = json_decode($request->getContent(), true);
$sql = "
SELECT appel
FROM " . Appel::class . " appel
LEFT JOIN ".Campagneprospect::class." campagneprospect WITH appel.campagneprospect=campagneprospect.id
LEFT JOIN ".Utilisateur::class." utilisateur WITH appel.utilisateur=utilisateur.id
LEFT JOIN ".Campagne::class." campagne WITH campagneprospect.campagne=campagne.id
LEFT JOIN ".Prospect::class." prospect WITH campagneprospect.prospect=prospect.id
";
return $this->findElementsWithJoin($sql, $data);
}
}