/**
  * {@inheritdoc}
  *
  * @param mixed            $value
  * @param AbstractPlatform $platform
  *
  * @throws ConversionException
  *
  * @return null|string
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Uuid || Uuid::isValid($value)) {
         return (string) $value;
     }
     throw OrmTypeConversionException::create()->with($value, self::NAME);
 }
 /**
  * {@inheritdoc}
  *
  * @param mixed            $value
  * @param AbstractPlatform $platform
  *
  * @throws ConversionException
  *
  * @return null|string
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Uuid) {
         return $value->getBytes();
     }
     if (Uuid::isValid($value)) {
         return Uuid::fromString($value)->getBytes();
     }
     try {
         return Uuid::fromBytes($value)->getBytes();
     } catch (\InvalidArgumentException $exception) {
         throw OrmTypeConversionException::create()->with($value, self::NAME);
     }
 }