@@ -301,6 +301,7 @@ Once configured, you can use the PostgreSQL types in your Symfony entities:
301301namespace App\E ntity;
302302
303303use Doctrine\O RM\M apping as ORM;
304+ use MartinGeorgiev\D octrine\D BAL\T ype;
304305use MartinGeorgiev\D octrine\D BAL\T ypes\V alueObject\D ateRange;
305306use MartinGeorgiev\D octrine\D BAL\T ypes\V alueObject\L tree;
306307use MartinGeorgiev\D octrine\D BAL\T ypes\V alueObject\N umericRange;
@@ -316,25 +317,25 @@ class Product
316317 #[ORM\C olumn]
317318 private ?int $id = null;
318319
319- #[ORM\C olumn(type: 'jsonb' )]
320+ #[ORM\C olumn(type: Type::JSONB )]
320321 private array $specifications = [];
321322
322- #[ORM\C olumn(type: 'text[]' )]
323+ #[ORM\C olumn(type: Type::TEXT_ARRAY )]
323324 private array $categories = [];
324325
325- #[ORM\C olumn(type: 'point' )]
326+ #[ORM\C olumn(type: Type::POINT )]
326327 private Point $manufacturingLocation;
327328
328- #[ORM\C olumn(type: 'numrange' )]
329+ #[ORM\C olumn(type: Type::NUMRANGE )]
329330 private NumericRange $priceRange;
330331
331- #[ORM\C olumn(type: 'daterange' )]
332+ #[ORM\C olumn(type: Type::DATERANGE )]
332333 private DateRange $availabilityPeriod;
333334
334- #[ORM\C olumn(type: 'inet' )]
335+ #[ORM\C olumn(type: Type::INET )]
335336 private string $originServerIp;
336337
337- #[ORM\C olumn(type: 'ltree' )]
338+ #[ORM\C olumn(type: Type::LTREE )]
338339 private Ltree $pathFromRoot;
339340}
340341` ` `
@@ -377,15 +378,17 @@ If you need to register types programmatically (e.g., in a bundle), you can do s
377378namespace App\S ervice;
378379
379380use Doctrine\D BAL\T ypes\T ype;
381+ use MartinGeorgiev\D octrine\D BAL\T ype;
382+ use MartinGeorgiev\D octrine\D BAL\T ypes\J sonb;
380383use Symfony\C omponent\D ependencyInjection\A ttribute\A utoconfigure;
381384
382385#[Autoconfigure(lazy: true)]
383386class DoctrineTypeRegistrar
384387{
385388 public function registerTypes(): void
386389 {
387- if (!Type::hasType('jsonb' )) {
388- Type::addType('jsonb', \M artinGeorgiev \D octrine \D BAL \T ypes \ J sonb::class);
390+ if (!Type::hasType(Type::JSONB )) {
391+ Type::addType(Type::JSONB, Jsonb::class);
389392 }
390393
391394 // Register other types as needed...
0 commit comments