Generic DBAL Types for Similar Value Objects
dev.to·2d·
Discuss: DEV
Diesel
Preview
Report Post

If you use Value Objects as entity identifiers in PHP, you eventually drown in custom DBAL types: boilerplate classes, repetitive configuration, and fragile mappings that break silently when someone forgets to register a type or the type name changes.

This problem shows up consistently in projects built with Symfony and Doctrine, especially when following DDD-style modeling where identifiers are not raw UUIDs but explicit Value Objects.

use Symfony\Component\Uid\UuidV7;

abstract class Uid
{
public static function create(): static
{
...

Similar Posts

Loading similar posts...