From e378a6d54fb2d1c61597f826bf46d166f03f2664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 24 Apr 2018 21:43:02 +0200 Subject: [PATCH] remove dump and fix exception --- Doctrine/Type/NativeDateIntervalType.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Doctrine/Type/NativeDateIntervalType.php b/Doctrine/Type/NativeDateIntervalType.php index fc341b3ef..7c9375628 100644 --- a/Doctrine/Type/NativeDateIntervalType.php +++ b/Doctrine/Type/NativeDateIntervalType.php @@ -30,7 +30,7 @@ class NativeDateIntervalType extends DateIntervalType if ($value === null || $value instanceof \DateInterval) { return $value; } - dump($value); + try { $strings = explode(' ', $value); @@ -44,11 +44,9 @@ class NativeDateIntervalType extends DateIntervalType $intervalSpec .= $this->convertEntry($strings); } while (next($strings) !== FALSE); - dump($intervalSpec); - return new \DateInterval($intervalSpec); } catch (\Exception $exception) { - throw $this->createConversionException($value); + throw $this->createConversionException($value, $exception); } } @@ -70,7 +68,7 @@ class NativeDateIntervalType extends DateIntervalType $unit = 'D'; break; default: - throw $this->createConversionException($value); + throw $this->createConversionException(implode('', $strings)); } 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); }