database icon indicating copy to clipboard operation
database copied to clipboard

time datetype

Open dennydanek opened this issue 4 years ago • 1 comments

https://github.com/nette/database/blob/66fbed8951e72de9fa8c41bf3c007c9ab15278b4/src/Database/Helpers.php#L223

create new \DateInterval by force can be unwanted. In case the key is primary - script ends with an exception, because \DateInterval doesn't have an __toString() method.

From my perspective would be better to store as string and add a new helper function for creating \DateInterval from string in Nette/utils.

Or much complicated way can be create new Class Nette\Utils\DateInterval exteded of \DateInterval which contain __toString() method - but there is a lots of options formating

Thanks for advice

dennydanek avatar Aug 13 '21 14:08 dennydanek

I added the option to configure row normalizer to disable conversion of intervals:

$db = new Nette\Database\Connection(...);
$db->setRowNormalizer((new Nette\Database\RowNormalizer)->skipInterval());

dg avatar Jan 19 '22 15:01 dg