-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add new Form WeekType #32061
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
Add new Form WeekType #32061
Conversation
ee85412
to
4eb5bec
Compare
(not tested though) Also im wondering if the underlying |
I wonder if we need to support different input formats for this form type. Right now it only supports a string that is in the same format as the one supported by the HTML5 week input type. However, I could imagine that some developers would like to have a kind of structure like an array with a week and a year element. |
@dFayet maybe compatibility with |
If we add a form for If we want to improve the fallback a bit, we could add a Anyway, I think adding a field type rendering a |
b9472ff
to
c6ef137
Compare
c6ef137
to
1f5c7c1
Compare
@dFayet Is this still work in progress or are you waiting for a review? I don't want to put pressure on you just ensure that you are not desperately waiting for a review. :) |
Your're right to ask @xabbuh :D The WIP tag might be too much as, beside the tests, and the questions added in the edit of this PR, I think this one is ready for some reviews. The subject of the DataTransformers is my main hesitation, should I write the tests now, or wait some feedback? |
@dFayet Looking at how the updated transformers would look like, it seems to me that having new transformers would be better. We may then also reconsider the idea that the norm data should be |
9b5cb92
to
5aa4ce3
Compare
@dFayet Thank you for working on this. I have left you a bunch of comments. But they are actually only about a few details. The overall picture looks quite good to me. 👍 |
no chance to be merged at 4.4 ? |
dca5642
to
fea3d59
Compare
21dcd3d
to
e375018
Compare
e375018
to
c4a2f02
Compare
@dFayet I have incorporated the review feedback. This looks ready to me now. Thank you for your work on this. I have kept your commit so you will still get the full credit. |
Thank to you @xabbuh but let's not forget that this is at least a 50-50 between us (+1 for you for your quick reaction) |
Thank you @dFayet. |
This PR was merged into the 4.4 branch. Discussion ---------- Add new Form WeekType | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #32029 | License | MIT | Doc PR | <!--symfony/symfony-docs#...--> coming soon ---- #### Update After the first try, I've updated the field to have more options, and be more "straight". The field acts like the `DateTimeType` or `TimeType`, various fields type (pure text, html5 type, select boxes), data validation, .... For that I took the choice to update the `DateTimeToStringTransformer` and `DateTimeToArrayTransformer` to make them work with weeks format. I was not sure if it was better to update them or create new ones, WDYT? Before addind tests and docs, it would be nice to have your first thoughts/comments 😊 Do you need/want a small test repo? Commits ------- c4a2f02 Add new Form WeekType
when looking at the input week page, would be a nice idea to have min and max for this too? or maybe as Validator? the step parameter might be a bit more complicated |
@Hanmac That's already possible: $builder->add('week', WeekType::class, [
'attr' => [
'min' => '2018-W18',
'max' => '2018-W26',
],
]); |
This PR was merged into the 4.4 branch. Discussion ---------- Add new WeekType Documentation Documents new symfony/symfony#32061 feature Fix #12583 Commits ------- 8cd2e65 Add WeekType Documentation
Update
After the first try, I've updated the field to have more options, and be more "straight".
The field acts like the
DateTimeType
orTimeType
, various fields type (pure text, html5 type, select boxes), data validation, ....For that I took the choice to update the
DateTimeToStringTransformer
andDateTimeToArrayTransformer
to make them work with weeks format.I was not sure if it was better to update them or create new ones, WDYT?
Before addind tests and docs, it would be nice to have your first thoughts/comments 😊
Do you need/want a small test repo?