diff --git a/src/DBUuid.php b/src/DBUuid.php index 6ce7b0f..274a158 100644 --- a/src/DBUuid.php +++ b/src/DBUuid.php @@ -100,6 +100,14 @@ public function nullValue() return null; } + public function setValue($value, $record = null, $markChanged = true) + { + if ($value && strlen($value) !== 16) { + $value = Uuid::fromString($value)->getBytes(); + } + return parent::setValue($value, $record, $markChanged); + } + public function prepValueForDB($value) { if (!$value) {