Skip to content

Commit

Permalink
Adding code back in UuidType
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 16, 2015
1 parent 77e74d5 commit 4373f30
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Database/Type/UuidType.php
Expand Up @@ -24,6 +24,23 @@
*/
class UuidType extends StringType
{

/**
* Casts given value from a PHP type to one acceptable by database
*
* @param mixed $value value to be converted to database equivalent
* @param Driver $driver object from which database preferences and configuration will be extracted
* @return mixed
*/
public function toDatabase($value, Driver $driver)
{
if ($value === null || $value === '') {
return null;
}

return parent::toDatabase($value, $driver);
}

/**
* Generate a new UUID
*
Expand All @@ -34,6 +51,12 @@ public function newId()
return Text::uuid();
}

/**
* Marshalls request data into a PHP string
*
* @param mixed $value The value to convert.
* @return string|null Converted value.
*/
public function marshal($value)
{
if ($value === null || $value === '') {
Expand Down

0 comments on commit 4373f30

Please sign in to comment.