/** * {@inheritdoc} */ public function convertToPHPValue($value) { if ('' === $value) { return null; } $val = unserialize($value); if ($val === false) { throw ConversionException::conversionToPhpFailed($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; }