Commit b0c49d46 authored by Mat's avatar Mat
Browse files

api, ajoute un groupe de sérialisation pour limiter la profondeur du json

parent e340555b
...@@ -141,7 +141,7 @@ class InfoAPIController extends MasterAPIController ...@@ -141,7 +141,7 @@ class InfoAPIController extends MasterAPIController
} }
$em->flush(); $em->flush();
return $this->api($info); return $this->api($info, 200, array('readInfos'));
} }
return $this->api($form, Response::HTTP_BAD_REQUEST); return $this->api($form, Response::HTTP_BAD_REQUEST);
} }
......
...@@ -58,7 +58,7 @@ class LettreAPIController extends MasterAPIController ...@@ -58,7 +58,7 @@ class LettreAPIController extends MasterAPIController
$em->persist($lettre); $em->persist($lettre);
$em->flush(); $em->flush();
return $this->api($lettre); return $this->api($lettre, 200, array('readLettres'));
} }
return $this->api($form, Response::HTTP_BAD_REQUEST); return $this->api($form, Response::HTTP_BAD_REQUEST);
} }
...@@ -88,7 +88,7 @@ class LettreAPIController extends MasterAPIController ...@@ -88,7 +88,7 @@ class LettreAPIController extends MasterAPIController
if ($lettre === null) { if ($lettre === null) {
return $this->api('Not found', Response::HTTP_NOT_FOUND); return $this->api('Not found', Response::HTTP_NOT_FOUND);
} }
return $this->api($lettre); return $this->api($lettre, 200, array('readLettres'));
} }
...@@ -113,7 +113,7 @@ class LettreAPIController extends MasterAPIController ...@@ -113,7 +113,7 @@ class LettreAPIController extends MasterAPIController
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid())
{ {
$em->flush(); $em->flush();
return $this->api($lettre); return $this->api($lettre, 200, array('readLettres'));
} }
return $this->api($form, Response::HTTP_BAD_REQUEST); return $this->api($form, Response::HTTP_BAD_REQUEST);
} }
...@@ -140,7 +140,7 @@ class LettreAPIController extends MasterAPIController ...@@ -140,7 +140,7 @@ class LettreAPIController extends MasterAPIController
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid())
{ {
$em->flush(); $em->flush();
return $this->api($lettre); return $this->api($lettre, 200, array('readLettres'));
} }
return $this->api($form, Response::HTTP_BAD_REQUEST); return $this->api($form, Response::HTTP_BAD_REQUEST);
} }
...@@ -211,7 +211,7 @@ class LettreAPIController extends MasterAPIController ...@@ -211,7 +211,7 @@ class LettreAPIController extends MasterAPIController
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid())
{ {
$em->flush(); $em->flush();
return $this->api([]); return $this->api($lettre, 200, array('readLettres'));
} }
return $this->api($form, Response::HTTP_BAD_REQUEST); return $this->api($form, Response::HTTP_BAD_REQUEST);
} }
......
...@@ -18,7 +18,7 @@ class SendMailCommand extends ContainerAwareCommand ...@@ -18,7 +18,7 @@ class SendMailCommand extends ContainerAwareCommand
{ {
$this $this
->setName('potage:mail:send') ->setName('potage:mail:send')
->setDescription("Envoie un biess mail !"); ->setDescription("Test d'envoi d'une infolettre!");
} }
public $newsletter; public $newsletter;
......
...@@ -60,6 +60,7 @@ class DefaultController extends MasterController ...@@ -60,6 +60,7 @@ class DefaultController extends MasterController
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid())
{ {
$retour = $newsletter->sendLettreToGroup($lettre); $retour = $newsletter->sendLettreToGroup($lettre);
} }
return $this->render('@Potage/Default/test.html.twig', array( return $this->render('@Potage/Default/test.html.twig', array(
......
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