From 2e9402d1a3d5761ede72f9d39ae5ea2324688bdc Mon Sep 17 00:00:00 2001 From: Warnar Boekkooi Date: Fri, 5 Sep 2014 11:22:32 +0800 Subject: [PATCH] Doctrine conversion make friendlier --- src/Doctrine/UuidType.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Doctrine/UuidType.php b/src/Doctrine/UuidType.php index 4c63f28..ffecee8 100644 --- a/src/Doctrine/UuidType.php +++ b/src/Doctrine/UuidType.php @@ -53,6 +53,10 @@ class UuidType extends Type return null; } + if ($value instanceof Uuid) { + return $value; + } + try { $uuid = Uuid::fromString($value); } catch (InvalidArgumentException $e) { @@ -74,7 +78,7 @@ class UuidType extends Type return null; } - if ($value instanceof Uuid) { + if ($value instanceof Uuid || Uuid::isValid($value)) { return (string) $value; }