Convert integer data into the database format.

@param string|resource $value The value to convert.
@param \Cake\Database\Driver $driver The driver instance to convert with.
@return float|null
973193
public function toDatabase($value, Driver $driver)
    {
        if ($value === null || $value === '') {
            return null;
        }

        return (float)$value;
    }
1041353
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        $result = null;

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

        return $result;
    }
1163135
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return;
        }
        $formatted = \number_format($value, 2, ',', '.');

        return $formatted;
    }
395418
protected function getRealValue(ContainerBuilder $container, $value)
    {
        return 0 === strpos($value, '%') ? $container->getParameter(trim($value, '%')) : $value;
    }
691279
public function convertToPHPValue($value, AbstractPlatform $platform)
    {

        switch ($platform->getName()) {
            case 'postgresql':
                $value = (is_resource($value)) ? stream_get_contents($value) : $value;
                $convertedValue = parent::convertToPHPValue(hex2bin($value), $platform);
                break;
            default:
                $convertedValue = parent::convertToPHPValue($value, $platform);
        }

        return $convertedValue;
    }
293454
public function convertToDatabaseValue($value, AbstractPlatform $platform)
	{
		if (is_null($value)) {
			return null;
		}
		
		$string = $value->getFullPath();
		
		return $string;
	}
704643
public function convertToDatabaseValue($value, AbstractPlatform $platform): int
    {
        \assert('is_int($value)');
        if (!isset($this->getValues()[$value])) {
            throw new \InvalidArgumentException('Invalid type.');
        }
        return $value;
    }
827077
public static function ToUInt64( $value, $provider = null )
	{
		$result = Convert::ToInt( $value, $provider );
		if ( ! $result ) return null;
		return abs( $result );
	}
851988
public static function ToInteger( $value, $provider = null )
	{
		if ( $value instanceof Integer)
		{
			return $value;
		}

		if ( is_int( $value ) )
		{
			$int = $value;
		}
		else
		{
			$int = Convert::ToDouble( $value, $provider );
			if ( is_null( $int ) ) throw new InvalidCastException("Unable to convert value '$value' to type Integer" );
		}

		return Integer::FromValue( $int );
	}
30094
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if (empty($value)) {
            return null;
        }

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

        try {
            $uuid = Uuid::fromBytes($value);
        } catch (InvalidArgumentException $e) {
            throw ConversionException::conversionFailed($value, static::NAME);
        }

        return $uuid;
    }
160135
public function convertToDBValue($value, IConnector $connector) {
        if ($value === null) {
            $value = 'null';
        }
        else {
            $type = $this->mapping['type'];
            switch ($type) {
                case 'bool'   :
                case 'boolean': $value = $connector->escapeLiteral((bool) $value); break;

                case 'int'    :
                case 'integer': $value = (string)(int) $value; break;

                case 'real'   :
                case 'float'  :
                case 'double' : $value = (string)(float) $value; break;

                case 'string' : $value = $connector->escapeLiteral((string) $value); break;

                default:
                    if (is_class($type)) {
                        $value = (new $type())->convertToDBValue($value, $this, $connector);
                        break;
                    }
                    throw new RuntimeException('Unsupported type "'.$type.'" for database mapping of '.$this->entityMapping->getClassName().'::'.$this->getName());
            }
        }
        return $value;
    }
79604
protected function serializeObject($value)
    {
        $serialized = EloquentDriver::serialize($value);

        return ($value !== $serialized) ? $serialized : parent::serializeObject($value);
    }
1343103
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (empty($value)) {
            return null;
        }

        if (
            $value instanceof UuidInterface
            || (
                (is_string($value) || method_exists($value, '__toString'))
                && Uuid::isValid((string) $value)
            )
        ) {
            return (string) $value;
        }

        throw ConversionException::conversionFailed($value, static::NAME);
    }
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)));
    }
283821
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return;
        }

        $formatter = new \NumberFormatter('pt_BR', \NumberFormatter::DECIMAL);
        $formatted = $formatter->parse($value);

        return $formatted;
    }
859613
public function convertToDatabaseValueSql($value, AbstractPlatform $platform)
    {
        return parent::convertToDatabaseValueSQL($value instanceof ModelInterface ? $value->pk : $value, $platform);
    }
142975
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if ($value instanceof \DateTime) {
            $value->setTimezone($this->getDateTimezone());
        }

        return parent::convertToDatabaseValue($value, $platform);
    }