public function convertToPHPValue($value, AbstractPlatform $platform) { $dtime = \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value); if (!$dtime) { throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeFormatString()); } return TimePointFactory::fromDateTime($dtime); }
public function convertToPHPValue($value) { if ($value === null) { return null; } $val = \DateTime::createFromFormat('!' . static::FORMAT, $value); if (!$val) { throw ConversionException::conversionFailed($value, $this->getName()); } return $val; }
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value instanceof DateTime) { return $value; } $val = DateTime::createFromFormat($platform->getDateTimeTzFormatString(), $value); if (!$val) { throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeTzFormatString()); } return $val; }
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } $val = \Psc\DateTime\Date::parse($platform->getDateFormatString(), $value); if (!$val) { throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString()); } return $val; }
/** * {@inheritdoc} */ public function convertToPHPValue($value) { if ('' === $value) { return null; } $val = unserialize($value); if ($val === false) { throw ConversionException::conversionToPhpFailed($value, $this); } return $val; }
public function convertToPHPValue($value, \Doctrine\DBAL\Platforms\AbstractPlatform $platform) { if ($value === null) { return null; } $value = is_resource($value) ? stream_get_contents($value) : $value; $val = unserialize($value); if ($val === false && $value !== 'b:0;') { throw ConversionException::conversionFailed($value, $this->getName()); } return $val; }
/** * {@inheritdoc} */ public function convertToPHPValue($value) { if (empty($value)) { return null; } elseif ($value instanceof \DateTime) { return $value; } $val = \DateTime::createFromFormat('c', $value); if (!$val) { throw ConversionException::conversionFailedFormat($value, $this); } return $val; }
/** * {@inheritdoc} */ public function convertToPHPValue($value) { if (empty($value)) { return null; } elseif ($value instanceof \DateInterval) { return $value; } try { $interval = new \DateInterval($value); } catch (\Exception $e) { throw ConversionException::conversionToPhpFailed($value, $this); } return $interval; }