Skip to content

Commit 1839389

Browse files
committed
Tweaks
1 parent fb137a0 commit 1839389

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

components/uid.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,27 +156,28 @@ type, which converts to/from UUID objects automatically::
156156
The UUID type was introduced in Symfony 5.2.
157157

158158
There is no generator to assign UUIDs automatically as the value of your entity
159-
primary keys, but you can use instead the following::
159+
primary keys, but you can use the following::
160160

161161
namespace App\Entity;
162162

163163
use Doctrine\ORM\Mapping as ORM;
164+
use Symfony\Component\Uid\Uuid;
164165
// ...
165166

166167
class User implements UserInterface
167168
{
168169
/**
169170
* @ORM\Id
170-
* @ORM\Column(type="ulid", unique=true)
171+
* @ORM\Column(type="uuid", unique=true)
171172
*/
172173
private $id;
173174

174175
public function __construct()
175176
{
176-
$this->id = new Ulid();
177+
$this->id = Uuid::v4();
177178
}
178179

179-
public function getId(): Ulid
180+
public function getId(): Uuid
180181
{
181182
return $this->id;
182183
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy