Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time datetype #282

Open
dennydanek opened this issue Aug 13, 2021 · 1 comment
Open

time datetype #282

dennydanek opened this issue Aug 13, 2021 · 1 comment

Comments

@dennydanek
Copy link
Contributor

$row[$key] = new \DateInterval("PT$m[2]H$m[3]M$m[4]S");

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

@dg
Copy link
Member

dg commented Jan 19, 2022

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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants