mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
⚡ start to expose fields of poll
This commit is contained in:
parent
d282bbca3b
commit
2c2c24b1bb
@ -10,6 +10,8 @@ fos_rest:
|
|||||||
# App\Exception\MyException: 403
|
# App\Exception\MyException: 403
|
||||||
# messages:
|
# messages:
|
||||||
# App\Exception\MyException: Forbidden area.
|
# App\Exception\MyException: Forbidden area.
|
||||||
|
routing_loader:
|
||||||
|
default_format: json
|
||||||
format_listener:
|
format_listener:
|
||||||
rules:
|
rules:
|
||||||
- { path: '^/',
|
- { path: '^/',
|
||||||
|
@ -60,12 +60,12 @@ class DefaultController extends AbstractController {
|
|||||||
*/
|
*/
|
||||||
public function getAllPollsAction() {
|
public function getAllPollsAction() {
|
||||||
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
||||||
$polls = $repository->findall();
|
$data = $repository->findall();
|
||||||
|
|
||||||
|
|
||||||
return $this->json( [
|
return $this->json( [
|
||||||
'message' => 'here are your polls',
|
'message' => 'here are your polls',
|
||||||
'data' => $polls,
|
'data' => $data,
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,39 +5,47 @@ namespace App\Entity;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use JMS\Serializer\Annotation as Serializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity(repositoryClass="App\Repository\PollRepository")
|
* @ORM\Entity(repositoryClass="App\Repository\PollRepository")
|
||||||
|
* @Serializer\ExclusionPolicy("ALL")
|
||||||
*/
|
*/
|
||||||
class Poll {
|
class Poll {
|
||||||
/**
|
/**
|
||||||
* @ORM\Id()
|
* @ORM\Id()
|
||||||
* @ORM\GeneratedValue()
|
* @ORM\GeneratedValue()
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
|
* @Serializer\Expose
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=255)
|
* @ORM\Column(type="string", length=255)
|
||||||
|
* @Serializer\Expose
|
||||||
*/
|
*/
|
||||||
private $title;
|
private $title;
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
|
* @Serializer\Expose
|
||||||
*/
|
*/
|
||||||
private $customUrl;
|
private $customUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vote restricted by a password
|
* vote restricted by a password in md5 format
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
*/
|
*/
|
||||||
private $password;
|
private $password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=1000)
|
* @ORM\Column(type="string", length=1000)
|
||||||
|
* @Serializer\Expose
|
||||||
*/
|
*/
|
||||||
private $description;
|
private $description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime")
|
||||||
|
* @Serializer\Expose
|
||||||
*/
|
*/
|
||||||
private $creationDate;
|
private $creationDate;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user