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
|
||||
# messages:
|
||||
# App\Exception\MyException: Forbidden area.
|
||||
routing_loader:
|
||||
default_format: json
|
||||
format_listener:
|
||||
rules:
|
||||
- { path: '^/',
|
||||
|
@ -60,12 +60,12 @@ class DefaultController extends AbstractController {
|
||||
*/
|
||||
public function getAllPollsAction() {
|
||||
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
||||
$polls = $repository->findall();
|
||||
$data = $repository->findall();
|
||||
|
||||
|
||||
return $this->json( [
|
||||
'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\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use JMS\Serializer\Annotation as Serializer;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\PollRepository")
|
||||
* @Serializer\ExclusionPolicy("ALL")
|
||||
*/
|
||||
class Poll {
|
||||
/**
|
||||
* @ORM\Id()
|
||||
* @ORM\GeneratedValue()
|
||||
* @ORM\Column(type="integer")
|
||||
* @Serializer\Expose
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255)
|
||||
* @Serializer\Expose
|
||||
*/
|
||||
private $title;
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Serializer\Expose
|
||||
*/
|
||||
private $customUrl;
|
||||
|
||||
/**
|
||||
* vote restricted by a password
|
||||
* vote restricted by a password in md5 format
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=1000)
|
||||
* @Serializer\Expose
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
* @Serializer\Expose
|
||||
*/
|
||||
private $creationDate;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user