/** * @override */ public function convertToPHPValue($value, AbstractPlatform $platform) { if (null !== $value) { if (1 !== preg_match('/^\\d+$/', $value)) { throw ConversionException::conversionFailedFormat($value, $this->getName(), '^\\d+$'); } $value = DateInterval::fromSeconds($value); } return $value; }
public function testFromSecondsCompare() { $seconds = DateInterval::fromSeconds('2056600500'); $interval = new DateInterval('P60Y60M60DT60H60M60S'); $this->assertEquals($seconds->toSeconds(), $interval->toSeconds()); }