Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
1f6f40c0
Commit
1f6f40c0
authored
Jul 26, 2018
by
Mat
Browse files
API optimisation: readInfos group
parent
dd512838
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/APIBundle/Controller/InfoAPIController.php
View file @
1f6f40c0
...
...
@@ -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'
)
);
}
...
...
src/PotageBundle/Entity/Info.php
View file @
1f6f40c0
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment