File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff 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
158158There 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 }
You can’t perform that action at this time.
0 commit comments