Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
reminec
Limaju Server Symfony
Commits
37e69692
Commit
37e69692
authored
Oct 05, 2019
by
Dominique Merle
💬
Browse files
Use UUIDs for polls and votes.
parent
61fd5538
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Entity/LimajuPoll.php
View file @
37e69692
...
...
@@ -9,6 +9,7 @@ use ApiPlatform\Core\Annotation\ApiSubresource;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Doctrine\Common\Collections\Collection
;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Ramsey\Uuid\UuidInterface
;
use
Symfony\Component\Serializer\Annotation\Groups
;
...
...
@@ -45,8 +46,13 @@ class LimajuPoll
/**
* @ORM\Id()
* @var UuidInterface
*
* @Groups({ "read" })
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
...
...
@@ -84,7 +90,7 @@ class LimajuPoll
$this
->
options
=
new
ArrayCollection
();
}
public
function
getId
():
?
int
public
function
getId
():
?
UuidInterface
{
return
$this
->
id
;
}
...
...
src/Entity/LimajuPollOptionVote.php
View file @
37e69692
...
...
@@ -6,6 +6,7 @@ namespace App\Entity;
use
ApiPlatform\Core\Annotation\ApiResource
;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Ramsey\Uuid\UuidInterface
;
use
Symfony\Component\Serializer\Annotation\Groups
;
/**
...
...
@@ -30,9 +31,13 @@ use Symfony\Component\Serializer\Annotation\Groups;
class
LimajuPollOptionVote
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
* @var UuidInterface
*
* @Groups({ "read" })
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
*/
private
$id
;
...
...
@@ -80,7 +85,7 @@ class LimajuPollOptionVote
public
function
getId
():
?
int
public
function
getId
():
?
UuidInterface
{
return
$this
->
id
;
}
...
...
Write
Preview
Supports
Markdown
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