Commit 7cb09523 authored by Mat's avatar Mat

voilà, la profondeur de 3 empêche d'avoir une requête trop longue

parent 40649db4
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace APIBundle\Controller; namespace APIBundle\Controller;
use JMS\Serializer\SerializationContext;
use PotageBundle\Controller\MasterController; use PotageBundle\Controller\MasterController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
...@@ -17,7 +18,7 @@ abstract class MasterAPIController extends MasterController ...@@ -17,7 +18,7 @@ abstract class MasterAPIController extends MasterController
protected function api($data, $status = 200) protected function api($data, $status = 200)
{ {
$serializer = $this->get('jms_serializer'); $serializer = $this->get('jms_serializer');
$serialized = $serializer->serialize($data, 'json'); $serialized = $serializer->serialize($data, 'json', SerializationContext::create()->enableMaxDepthChecks());
// if ($data instanceof Form) { // if ($data instanceof Form) {
// $status = 400; // $status = 400;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace PotageBundle\Entity; namespace PotageBundle\Entity;
use JMS\Serializer\Annotation\MaxDepth;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
...@@ -39,6 +40,7 @@ class Utilisateur ...@@ -39,6 +40,7 @@ class Utilisateur
* joinColumns={@ORM\JoinColumn(name="id_groupe", referencedColumnName="id")}, * joinColumns={@ORM\JoinColumn(name="id_groupe", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="id_utilisateur", referencedColumnName="id")} * inverseJoinColumns={@ORM\JoinColumn(name="id_utilisateur", referencedColumnName="id")}
* ) * )
* @MaxDepth(3)
*/ */
private $groupes; private $groupes;
......
...@@ -23,11 +23,6 @@ class UtilisateurRepository extends \Doctrine\ORM\EntityRepository ...@@ -23,11 +23,6 @@ class UtilisateurRepository extends \Doctrine\ORM\EntityRepository
public function findAllForAPIReadPaginate($paginate, $start, $column = null, $order = null) public function findAllForAPIReadPaginate($paginate, $start, $column = null, $order = null)
{ {
$qb = $this->createQueryBuilder('u') $qb = $this->createQueryBuilder('u')
//->select('u.id', 'u.nom', 'u.prenom', 'u.email', 'u.createdAt', 'u.updatedAt')
//->leftJoin('u.groupes', 'g')
//->addSelect('g.id gid', 'g.nom gNom')
//->leftJoin('u.user', 'fu')
//->addSelect('fu.id fuid', 'fu.email fuemail', 'fu.username funame')
->setMaxResults($paginate) ->setMaxResults($paginate)
->setFirstResult(($start - 1) * $paginate); ->setFirstResult(($start - 1) * $paginate);
if ($column !== null) { if ($column !== null) {
......
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment