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
feat: simplification Renderer->columnOptions output for datetime now #33
Conversation
Codecov Report
@@ Coverage Diff @@
## 3.x #33 +/- ##
============================================
- Coverage 95.91% 95.59% -0.33%
- Complexity 246 248 +2
============================================
Files 29 29
Lines 784 726 -58
============================================
- Hits 752 694 -58
Misses 32 32
Continue to review full report at Codecov.
|
src/Atomizer/Renderer.php
Outdated
@@ -401,6 +401,10 @@ private function columnOptions(Serializer $serializer, AbstractColumn $column): | |||
$options['precision'] = $column->getPrecision(); | |||
} | |||
|
|||
if ($options['default'] == $column::DATETIME_NOW) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend adding a strict comparison here (===).
It might be worth adding a test with new functionality. What do you think? @roxblnfk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if use strict comparison here, before/after example don't be work (because Fragment does not converted to string).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it is better to check the type, cast to the needed type, and compare? If it doesn't add a lot of code.
i don't have ideas for testing this functionality. Poor test ⬆️ |
Co-authored-by: Aleksei Gagarin <roxblnfk@ya.ru>
Thank you! |
Before
After
CURRENT_TIMESTAMP will be translated for postgresql to now() in AbstractColumn (cycle/database)