{@inheritdoc}

@param Uuid|null                                 $value
@param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
970197
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (empty($value)) {
            return null;
        }

        if ($value instanceof Uuid || Uuid::isValid($value)) {
            return (string) $value;
        }

        throw ConversionException::conversionFailed($value, self::NAME);
    }
1287130
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (empty($value)) {
            return null;
        }

        if ($value instanceof Money) {
            return (string) $value->getCurrency().' '.$value->getAmount();
        }

        throw ConversionException::conversionFailed($value, self::NAME);
    }
1208150
public final void setGuaranteedGatheringTargetUUID(SIBUuid12 value) {
    if (value != null)
      jmo.setField(ControlAccess.GATHERINGTARGETUUID_VALUE, value.toByteArray());
    else
      jmo.setField(ControlAccess.GATHERINGTARGETUUID, ControlAccess.IS_GATHERINGTARGETUUID_EMPTY);
  }
1219352
public function toPHP($value, Driver $driver)
    {
        if ($value === null) {
            return null;
        }
        if (is_string($value)) {
            return $this->convertBinaryUuidToString($value);
        }
        if (is_resource($value)) {
            return $value;
        }

        throw new Exception(sprintf('Unable to convert %s into binary uuid.', gettype($value)));
    }
298269
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (null === $value || '' === $value) {
            return $value;
        }

        if ( ! $value instanceof Currency) {
            $type = is_object($value) ? get_class($value) : gettype($value);
            throw new \InvalidArgumentException(sprintf('You have to pass an object of kind \Money\Currency to use the Doctrine type CurrencyType. "%s" passed instead.', $type));
        }

        // The value is automatically transformed into a string thans to the __toString() method
        return $value;
    }
1202634
public function convertToDatabaseValue ($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return null;
        } elseif ($value instanceof \DateTime) {
            return $value->format('Y-m-d H:i:s.uO');
        } elseif (is_string($value)) {
            try {
                return parent::convertToDatabaseValue($value, $platform);
            } catch (\Exception $e) {
                try {
                    $dt = new \DateTime($value);
                    return $dt->format('Y-m-d H:i:s.uO');
                } catch (\Exception $e) {
                    throw new \Exception('Date "'.$value.'" is not a valid date');
                }
            }
        }

        throw new \Exception('Date "'.$value.'" is not a valid date');
    }
1296623
public function convertToPHPValueSql($value, AbstractPlatform $platform)
    {
        $opts = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;

        if (is_object($value)) {
            if (method_exists($value, 'toJson')) {
                $value = $value->toJson();
            } elseif (method_exists($value, 'toArray')) {
                $value = json_encode($value->toArray(), $opts);
            } else {
                $value = json_encode($value, $opts);
            }
        }

        return parent::convertToPHPValueSql($value, $platform);
    }
1292236
public function setSignature($value = null)
    {
        if ($value !== null && ! $value instanceof \Protobuf\Stream) {
            $value = \Protobuf\Stream::wrap($value);
        }

        $this->Signature = $value;
    }
330790
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if (empty($value)) {
            return null;
        }

        if ($value instanceof UuidInterface) {
            return $value;
        }

        try {
            return $this->decode($value);
        } catch (InvalidArgumentException $e) {
            throw ConversionException::conversionFailed($value, self::NAME);
        }
    }
1221646
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if (!$value) {
            return null;
        }

        if ($platform instanceof MySqlPlatform) {
            $data = sscanf($value, 'POINT(%f %f)');
        } else {
            $data = sscanf($value, "(%f,%f)");
        }

        return new Point($data[0], $data[1]);
    }
945553
public final void resolve(UUID value) {
		future.complete(new Tree((Tree) null, null, value));
	}
602068
public function convertToPHPValue($value, PlatformInterface $platform)
    {
        if ($value === null) {
            return;
        }

        if (is_string($value)) {
            $value = fopen('data://text/plain;base64,'.base64_encode($value), 'r');
        }

        if (!is_resource($value)) {
            throw TypeException::conversionToPHPFailed($value, $this->getName());
        }

        return $value;
    }
1371583
public function convertToDatabaseValue ($value, AbstractPlatform $platform) {
		if ($value === null) {
			return null;
		}

		$value -> setTimezone(self::getUTCTimeZone());
		return $value -> format($platform -> getDateTimeFormatString());
	}
132623
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return $value;
        }

        if (! ($value instanceof GeometryInterface)) {
            throw new InvalidValueException('Geometry column values must implement GeometryInterface');
        }

        return $this->getSpatialPlatform($platform)->convertToDatabaseValue($this, $value);
    }
1085462
public function convertToDatabaseValue($value, AbstractPlatform $platform) : ?string
    {
        if ($value instanceof DateTime) {
            $value->setTimezone($this->getUtc());
        }

        return parent::convertToDatabaseValue($value, $platform);
    }
1040649
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        $result = null;

        if ($value !== null && ($dateOrNull = parent::convertToPHPValue($value, $platform)) !== null) {
            // despite the name it's not null already
            $result = DateTime::createFromDateTime($dateOrNull);
        }

        return $result;
    }
704643
public function convertToDatabaseValue($value, AbstractPlatform $platform): int
    {
        \assert('is_int($value)');
        if (!isset($this->getValues()[$value])) {
            throw new \InvalidArgumentException('Invalid type.');
        }
        return $value;
    }