public function convertToPHPValue($value, \Doctrine\DBAL\Platforms\AbstractPlatform $platform) { if ($value === '' || $value === null) { $value = 'a:0:{}'; } return parent::convertToPHPValue($value, $platform); // TODO: Change the autogenerated stub }
/** * {@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); }
/** * @param mixed $value * @param AbstractPlatform $platform * * @return array */ public function convertToPHPValue($value, AbstractPlatform $platform) { try { return parent::convertToPHPValue($value, $platform); } catch (ConversionException $exception) { return []; } catch (ContextErrorException $exeption) { return []; } }
public function convertToPHPValue($value, \Doctrine\DBAL\Platforms\AbstractPlatform $platform) { if (is_object($value)) { return get_object_vars($value); } else { if (is_array($value)) { return $value; } else { if (!$value) { return array(); } } } return parent::convertToPHPValue($value, $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); }