Commit 70f93d33 authored by Mat's avatar Mat

API optimisation: readOffres group

parent 1f6f40c0
......@@ -72,7 +72,7 @@ class OffreAPIController extends MasterAPIController
{
$em = $this->getDoctrine()->getManager();
$offres = $em->getRepository('PotageBundle:Offre')->findAllByStatusForRead($status);
return $this->api($offres);
return $this->api($offres, 200, array('readOffres'));
}
......
......@@ -22,13 +22,14 @@ class Offre
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Serializer\Groups({"readLettres"})
* @Serializer\Groups({"readLettres", "readOffres"})
*/
private $id;
/**
* @var OffreLegumes[]
* @ORM\OneToMany(targetEntity="PotageBundle\Entity\OffreLegumes", mappedBy="offre")
* @Serializer\Groups({"readOffres"})
*/
private $offreLegumes;
......@@ -42,7 +43,7 @@ class Offre
* @var string
*
* @ORM\Column(name="reference", type="string", length=16, unique=true)
* @Serializer\Groups({"readLettres"})
* @Serializer\Groups({"readLettres", "readOffres"})
*/
private $reference;
......@@ -50,6 +51,7 @@ class Offre
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime")
* @Serializer\Groups({"readOffres"})
*/
private $createdAt;
......@@ -57,6 +59,7 @@ class Offre
* @var \DateTime
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
* @Serializer\Groups({"readOffres"})
*/
private $updatedAt;
......@@ -64,6 +67,7 @@ class Offre
* @var \DateTime
*
* @ORM\Column(name="ended_at", type="datetime")
* @Serializer\Groups({"readOffres"})
*/
private $endedAt;
......@@ -71,12 +75,14 @@ class Offre
* @var string
*
* @ORM\Column(name="status", type="string", columnDefinition="enum('draft', 'current', 'closed', 'trash')")
* @Serializer\Groups({"readOffres"})
*/
private $status;
/**
* @var string
* @ORM\Column(name="sorted", type="string", nullable=true)
* @Serializer\Groups({"readOffres"})
*/
private $sorted;
......
......@@ -2,6 +2,7 @@
namespace PotageBundle\Entity;
use JMS\Serializer\Annotation as Serializer;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
......@@ -24,6 +25,7 @@ class OffreLegumes
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Serializer\Groups({"readOffres"})
*/
private $id;
......@@ -59,6 +61,7 @@ class OffreLegumes
* @var string
*
* @ORM\Column(name="nom", type="string", length=100)
* @Serializer\Groups({"readOffres"})
*/
private $nom;
......
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