Incompatibility with ramsey/uuid 4.1
janlanger opened this issue · 5 comments
janlanger commented
The UuidBinaryOrderedTimeType
is incompatible with latest ramsey/uuid 4.1, when using Doctrine Second Level cache. Uuid loaded from DB has type Ramsey\Uuid\Rfc4122\UuidV1
, but when this type is serialized/deserialized (in caching), type conversion fails with Could not convert database value "11ead339-8a48-dd88-a..." to Doctrine Type uuid_binary_ordered_time. Expected format: UuidV1
Sample:
$uuid = Uuid::uuid1();
$type = new UuidBinaryOrderedTimeType();
$platform = new MySQL80Platform();
var_dump(get_class($uuid), $uuid->getVersion()); //LazyUuidFromString, 1
$dbValue = $type->convertToDatabaseValue($uuid, $platform);
$phpValue = $type->convertToPHPValue($dbValue, $platform);
var_dump(get_class($phpValue), $phpValue->getVersion()); // Rfc4122\UuidV1, 1
$unserialized = unserialize(serialize($phpValue)); // simulating uuid loaded from cache
var_dump(get_class($unserialized), $unserialized->getVersion()); // Rfc4122\UuidV1, NULL
$type->convertToDatabaseValue($unserialized, $platform); // throws exception
Probably related to ramsey/uuid#324, not sure if it is issue there or here...
ramsey commented
Thanks for reporting. This is related to ramsey/uuid#327
stof commented
which version of the the library are you using ?
537mfb commented
see if the discussion in ramsey/uuid#329 helps
ramsey commented
Upgrading to ramsey/uuid 4.2 should fix this. If not, please let me know.