-
-
Notifications
You must be signed in to change notification settings - Fork 424
make:crud | Improvements #241
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
Conversation
src/GeneratorTwigHelper.php
Outdated
case 'datetime': | ||
$printCode .= ' ? '.$printCode.'|date(\'Y-m-d H:i:s\') : \'\''; | ||
break; | ||
case 'dateinterval': | ||
$printCode .= ' ? '.$printCode.'.format(\'%y years, %m month, %d days\') : \'\''; |
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.
What about ('%y year(s), %m month(s), %d day(s)') ?
How about adding new test cases to make sure these behave as intended?
|
case 'json': | ||
case 'json_array': | ||
$printCode .= ' is iterable ? '.$printCode.'|join(\', \') : '.$printCode; | ||
break; |
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.
Interesting! From looking at the docs, it seems like the value in this field will always be an array
or null
. Which case were you covering with the is iterable
?
And, because the array can be an associative array, the |join
won't look quite right in those cases. We could use dump()
WDYT?
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'll check it again. I thought there could be string value.
dump()
is a good idea, but will it work without debug package?
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.
It believe that it DOES work without debug
- it reverts to var_dump()
. We can add a json
field to our entity in the functional test to be sure.
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.
Oh, you know what? Let's use |json_encode
. That will print nicely, and make it very obvious that this is a JSON field. And, it will definitely work :).
@sadikoff if you agree, can you make that change? Also, if you rebase from the latest master, the tests should be closer to passing.
I agree! And actually, this test could be even a little bit cooler if we actually "rendered" the result through Twig (passing in some real |
@sadikoff Can you rebase this? I want to make sure the tests pass with the latest changes on master. Also, there are 2 changes in this PR to |
@weaverryan ok, I'll rebase it P.S. I think travis will be more stable with this changes |
Thanks Vladimir! |
Added datetimetz, *_immutable, dateinterval and json fileds processing.
closes #234
closes #270