@@ -137,11 +137,12 @@ type, which converts to/from UUID objects automatically::
137137 namespace App\Entity;
138138
139139 use Doctrine\ORM\Mapping as ORM;
140+ use Symfony\Bridge\Doctrine\Types\UuidType;
140141
141142 #[ORM\Entity(repositoryClass: ProductRepository::class)]
142143 class Product
143144 {
144- #[ORM\Column(type: 'uuid' )]
145+ #[ORM\Column(type: UuidType::NAME )]
145146 private $someProperty;
146147
147148 // ...
@@ -153,12 +154,13 @@ entity primary keys::
153154 namespace App\Entity;
154155
155156 use Doctrine\ORM\Mapping as ORM;
157+ use Symfony\Bridge\Doctrine\Types\UuidType;
156158 use Symfony\Component\Uid\Uuid;
157159
158160 class User implements UserInterface
159161 {
160162 #[ORM\Id]
161- #[ORM\Column(type: 'uuid' , unique: true)]
163+ #[ORM\Column(type: UuidType::NAME , unique: true)]
162164 #[ORM\GeneratedValue(strategy: 'CUSTOM')]
163165 #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
164166 private $id;
@@ -180,6 +182,8 @@ of the UUID parameters::
180182 // src/Repository/ProductRepository.php
181183
182184 // ...
185+ use Symfony\Bridge\Doctrine\Types\UuidType;
186+
183187 class ProductRepository extends ServiceEntityRepository
184188 {
185189 // ...
@@ -188,8 +192,8 @@ of the UUID parameters::
188192 {
189193 $qb = $this->createQueryBuilder('p')
190194 // ...
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 )
193197
194198 // alternatively, you can convert it to a value compatible with
195199 // the type inferred by Doctrine
@@ -294,11 +298,12 @@ type, which converts to/from ULID objects automatically::
294298 namespace App\Entity;
295299
296300 use Doctrine\ORM\Mapping as ORM;
301+ use Symfony\Bridge\Doctrine\Types\UlidType;
297302
298303 #[ORM\Entity(repositoryClass: ProductRepository::class)]
299304 class Product
300305 {
301- #[ORM\Column(type: 'ulid' )]
306+ #[ORM\Column(type: UlidType::NAME )]
302307 private $someProperty;
303308
304309 // ...
@@ -310,12 +315,13 @@ entity primary keys::
310315 namespace App\Entity;
311316
312317 use Doctrine\ORM\Mapping as ORM;
318+ use Symfony\Bridge\Doctrine\Types\UlidType;
313319 use Symfony\Component\Uid\Ulid;
314320
315321 class Product
316322 {
317323 #[ORM\Id]
318- #[ORM\Column(type: 'ulid' , unique: true)]
324+ #[ORM\Column(type: UlidType::NAME , unique: true)]
319325 #[ORM\GeneratedValue(strategy: 'CUSTOM')]
320326 #[ORM\CustomIdGenerator(class: 'doctrine.ulid_generator')]
321327 private $id;
@@ -338,6 +344,8 @@ of the ULID parameters::
338344 // src/Repository/ProductRepository.php
339345
340346 // ...
347+ use Symfony\Bridge\Doctrine\Types\UlidType;
348+
341349 class ProductRepository extends ServiceEntityRepository
342350 {
343351 // ...
@@ -346,8 +354,8 @@ of the ULID parameters::
346354 {
347355 $qb = $this->createQueryBuilder('p')
348356 // ...
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 )
351359
352360 // alternatively, you can convert it to a value compatible with
353361 // the type inferred by Doctrine
0 commit comments