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