/** * {@inheritdoc} */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (!$value instanceof Coordinate) { throw ConversionException::conversionFailed($value, $this->getName()); } $data = [$value->getLatitude(), $value->getLongitude(), $value->isNoWrap()]; return parent::convertToDatabaseValue($data, $platform); }
/** * Converts a value from its PHP representation to its database representation * of this type. * * @param array $array The value to convert. * @param AbstractPlatform $platform The currently used database platform. * @return mixed The database representation of the value. */ public function convertToDatabaseValue($array, AbstractPlatform $platform) { $this->initializeDependencies(); $this->encodeObjectReferences($array); switch ($platform->getName()) { case 'postgresql': return bin2hex(parent::convertToDatabaseValue($array, $platform)); default: return parent::convertToDatabaseValue($array, $platform); } }
/** * Converts a value from its PHP representation to its database representation * of this type. * * @param array $array The value to convert. * @param AbstractPlatform $platform The currently used database platform. * @return mixed The database representation of the value. */ public function convertToDatabaseValue($array, AbstractPlatform $platform) { $this->initializeDependencies(); $this->encodeObjectReferences($array); return parent::convertToDatabaseValue($array, $platform); }
/** * {@inheritdoc} */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { $convertedValue = parent::convertToDatabaseValue($value, $platform); return base64_encode($convertedValue); }