@@ -137,11 +137,12 @@ type, which converts to/from UUID objects automatically::
137
137
namespace App\Entity;
138
138
139
139
use Doctrine\ORM\Mapping as ORM;
140
+ use Symfony\Bridge\Doctrine\Types\UuidType;
140
141
141
142
#[ORM\Entity(repositoryClass: ProductRepository::class)]
142
143
class Product
143
144
{
144
- #[ORM\Column(type: 'uuid' )]
145
+ #[ORM\Column(type: UuidType::NAME )]
145
146
private $someProperty;
146
147
147
148
// ...
@@ -153,12 +154,13 @@ entity primary keys::
153
154
namespace App\Entity;
154
155
155
156
use Doctrine\ORM\Mapping as ORM;
157
+ use Symfony\Bridge\Doctrine\Types\UuidType;
156
158
use Symfony\Component\Uid\Uuid;
157
159
158
160
class User implements UserInterface
159
161
{
160
162
#[ORM\Id]
161
- #[ORM\Column(type: 'uuid' , unique: true)]
163
+ #[ORM\Column(type: UuidType::NAME , unique: true)]
162
164
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
163
165
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
164
166
private $id;
@@ -180,6 +182,8 @@ of the UUID parameters::
180
182
// src/Repository/ProductRepository.php
181
183
182
184
// ...
185
+ use Symfony\Bridge\Doctrine\Types\UuidType;
186
+
183
187
class ProductRepository extends ServiceEntityRepository
184
188
{
185
189
// ...
@@ -188,8 +192,8 @@ of the UUID parameters::
188
192
{
189
193
$qb = $this->createQueryBuilder('p')
190
194
// ...
191
- // add 'uuid' as the third argument to tell Doctrine that this is a UUID
192
- ->setParameter('user', $user->getUuid(), 'uuid' )
195
+ // add UuidType::NAME as the third argument to tell Doctrine that this is a UUID
196
+ ->setParameter('user', $user->getUuid(), UuidType::NAME )
193
197
194
198
// alternatively, you can convert it to a value compatible with
195
199
// the type inferred by Doctrine
@@ -294,11 +298,12 @@ type, which converts to/from ULID objects automatically::
294
298
namespace App\Entity;
295
299
296
300
use Doctrine\ORM\Mapping as ORM;
301
+ use Symfony\Bridge\Doctrine\Types\UlidType;
297
302
298
303
#[ORM\Entity(repositoryClass: ProductRepository::class)]
299
304
class Product
300
305
{
301
- #[ORM\Column(type: 'ulid' )]
306
+ #[ORM\Column(type: UlidType::NAME )]
302
307
private $someProperty;
303
308
304
309
// ...
@@ -310,12 +315,13 @@ entity primary keys::
310
315
namespace App\Entity;
311
316
312
317
use Doctrine\ORM\Mapping as ORM;
318
+ use Symfony\Bridge\Doctrine\Types\UlidType;
313
319
use Symfony\Component\Uid\Ulid;
314
320
315
321
class Product
316
322
{
317
323
#[ORM\Id]
318
- #[ORM\Column(type: 'ulid' , unique: true)]
324
+ #[ORM\Column(type: UlidType::NAME , unique: true)]
319
325
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
320
326
#[ORM\CustomIdGenerator(class: 'doctrine.ulid_generator')]
321
327
private $id;
@@ -338,6 +344,8 @@ of the ULID parameters::
338
344
// src/Repository/ProductRepository.php
339
345
340
346
// ...
347
+ use Symfony\Bridge\Doctrine\Types\UlidType;
348
+
341
349
class ProductRepository extends ServiceEntityRepository
342
350
{
343
351
// ...
@@ -346,8 +354,8 @@ of the ULID parameters::
346
354
{
347
355
$qb = $this->createQueryBuilder('p')
348
356
// ...
349
- // add 'ulid' as the third argument to tell Doctrine that this is a ULID
350
- ->setParameter('user', $user->getUlid(), 'ulid' )
357
+ // add UlidType::NAME as the third argument to tell Doctrine that this is a ULID
358
+ ->setParameter('user', $user->getUlid(), UlidType::NAME )
351
359
352
360
// alternatively, you can convert it to a value compatible with
353
361
// the type inferred by Doctrine
0 commit comments