Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
mathieu
potage
Commits
70f93d33
Commit
70f93d33
authored
Jul 26, 2018
by
Mat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API optimisation: readOffres group
parent
1f6f40c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
src/APIBundle/Controller/OffreAPIController.php
src/APIBundle/Controller/OffreAPIController.php
+1
-1
src/PotageBundle/Entity/Offre.php
src/PotageBundle/Entity/Offre.php
+8
-2
src/PotageBundle/Entity/OffreLegumes.php
src/PotageBundle/Entity/OffreLegumes.php
+3
-0
No files found.
src/APIBundle/Controller/OffreAPIController.php
View file @
70f93d33
...
...
@@ -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'
)
);
}
...
...
src/PotageBundle/Entity/Offre.php
View file @
70f93d33
...
...
@@ -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
;
...
...
src/PotageBundle/Entity/OffreLegumes.php
View file @
70f93d33
...
...
@@ -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
;
...
...
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