Commit 1f6f40c0 authored by Mat's avatar Mat

API optimisation: readInfos group

parent dd512838
......@@ -44,7 +44,7 @@ class InfoAPIController extends MasterAPIController
$isPost = $type === 'actu' ? 1 : 0;
$em = $this->getDoctrine()->getManager();
$infos = $em->getRepository('PotageBundle:Info')->findAllByTypeForAPIRead($isPost);
return $this->api($infos);
return $this->api($infos, 200, array('readInfos'));
}
......
......@@ -22,7 +22,7 @@ class Info
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Serializer\Groups({"readLettres"})
* @Serializer\Groups({"readLettres", "readInfos"})
*/
private $id;
......@@ -35,55 +35,63 @@ class Info
/**
* @var string
* @ORM\Column(name="title", type="string", length=150)
* @Serializer\Groups({"readLettres"})
* @Serializer\Groups({"readLettres", "readInfos"})
*/
private $title;
/**
* @var string
* @ORM\Column(name="subtitle", type="string", length=150, nullable=true)
* @Serializer\Groups({"readInfos"})
*/
private $subtitle;
/**
* @var string
* @ORM\Column(name="text", type="text")
* @Serializer\Groups({"readInfos"})
*/
private $text;
/**
* @var string
* @ORM\Column(name="is_post", type="boolean")
* @Serializer\Groups({"readInfos"})
*/
private $isPost;
/**
* @var string
* @ORM\Column(name="status", type="string", columnDefinition="enum('draft', 'posted', 'trash')")
* @Serializer\Groups({"readInfos"})
*/
private $status;
/**
* @var string
* @ORM\Column(name="color", length=10, nullable=true)
* @Serializer\Groups({"readInfos"})
*/
private $color;
/**
* @var \DateTime;
* @ORM\Column(name="posted_at", type="datetime", nullable=true)
* @Serializer\Groups({"readInfos"})
*/
private $postedAt;
/**
* @var \DateTime;
* @ORM\Column(name="created_at", type="datetime")
* @Serializer\Groups({"readInfos"})
*/
private $createdAt;
/**
* @var \DateTime;
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
* @Serializer\Groups({"readInfos"})
*/
private $updatedAt;
......
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