Skip to content

Commit

Permalink
support assigning uuid as string
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala authored Sep 26, 2022
1 parent bdaab58 commit dd7f4db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/DBUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit dd7f4db

Please sign in to comment.