mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
remove dump and fix exception
This commit is contained in:
parent
19e30d90c5
commit
e378a6d54f
@ -30,7 +30,7 @@ class NativeDateIntervalType extends DateIntervalType
|
|||||||
if ($value === null || $value instanceof \DateInterval) {
|
if ($value === null || $value instanceof \DateInterval) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
dump($value);
|
|
||||||
try {
|
try {
|
||||||
$strings = explode(' ', $value);
|
$strings = explode(' ', $value);
|
||||||
|
|
||||||
@ -44,11 +44,9 @@ class NativeDateIntervalType extends DateIntervalType
|
|||||||
$intervalSpec .= $this->convertEntry($strings);
|
$intervalSpec .= $this->convertEntry($strings);
|
||||||
} while (next($strings) !== FALSE);
|
} while (next($strings) !== FALSE);
|
||||||
|
|
||||||
dump($intervalSpec);
|
|
||||||
|
|
||||||
return new \DateInterval($intervalSpec);
|
return new \DateInterval($intervalSpec);
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
throw $this->createConversionException($value);
|
throw $this->createConversionException($value, $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +68,7 @@ class NativeDateIntervalType extends DateIntervalType
|
|||||||
$unit = 'D';
|
$unit = 'D';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw $this->createConversionException($value);
|
throw $this->createConversionException(implode('', $strings));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $current.$unit;
|
return $current.$unit;
|
||||||
@ -86,7 +84,7 @@ class NativeDateIntervalType extends DateIntervalType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createConversionException($value)
|
protected function createConversionException($value, $exception = null)
|
||||||
{
|
{
|
||||||
return ConversionException::conversionFailedFormat($value, $this->getName(), 'xx year xx mons xx days 01:02:03', $exception);
|
return ConversionException::conversionFailedFormat($value, $this->getName(), 'xx year xx mons xx days 01:02:03', $exception);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user