/** * @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; }
/** * @dataProvider getSpecs */ public function testToSpec($spec) { $interval = new DateInterval($spec); $this->assertEquals($spec, $interval->toSpec()); }
/** * @override */ public function getSql(SqlWalker $sqlWalker) { return DateInterval::toSeconds(new DateInterval($this->intervalSpec->value)); }