Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[2.3] [Form] Implemented form processors#6522
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
This can be moved afterif below.
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 mean line above 😮
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.
That's a rather pointless micro optimization.
webmozart commentedDec 30, 2012
Added the helpers |
UPGRADE-2.2.md Outdated
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.
The example inBefore andAfter will probably confuse people that use theelse part of the condition. So it should make clear that one must checkisBound before falsely adding flash messages about an invalid form (that is not even bound).
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.
Fixed
webmozart commentedDec 31, 2012
We discussed in#5493 whether or What do you think? |
webmozart commentedDec 31, 2012
Another question that remains to be answered: With the current implementation, the attributes passed in the Solutions that come to mind: (a) Move the rendering of the attributes from the (b) Don't render a (c) Don't render any attributes in the Opinions? While (c) is the best solution from a BC point of view, I think it is rather unintuitive. As a newcomer, if I put a "class" attribute on a form, I would expect it to be on the outermost (a) and (b), on the other hand, break BC for those people that use |
webmozart commentedDec 31, 2012
Added the helper |
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.
you should also merge `$_FILES`` to handle file uploads in the native processor and be consistent with the Request one
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.
Fixed. Had to copy over some code fromFileBag for that.
Tobion commentedDec 31, 2012
@bschussek I think And to the question about attributes: I think we shouldnot maintain BC here with c) because attributes are better applied to the parent. Using CSS you can easily select the child with |
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.
As mentioned, inputs must be wrapped with a block level element like<div> to be valid HTML4 Strict. So this would need to be changed too.
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.
This will be fixed by#6528.
webmozart commentedDec 31, 2012
@Tobion This is not correct. With (b), each row would still be wrapped in a |
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.
you should document the method in the interface
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.
Thanks, fixed
webmozart commentedJan 1, 2013
I propose to postpone the question about the wrapping @fabpot This PR should be mergeable. |
webmozart commentedJan 2, 2013
Updated the documentation. |
weaverryan commentedJan 2, 2013
Hi guys! I certainly don't mind the addition of the new features here, but I'm -1 on the BC breaks and deprecations. I don't love the deprecation of Also, I really really don't like the deprecation of Overall, I'd like to see these "nice" things added in a way where they can co-exist with what we have currently. These are really nice features, but there's so much code that will need to update and "education" that will need to happen because the form framework is already being used in so many places. Thanks! |
webmozart commentedJan 2, 2013
@weaverryan For reference, this PR does not contain any (immediate) BC breaks, just deprecations. We can leave in
|
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.
Again, this looks like the allowed methods can be changed, like adding or removing some. But that's not the case.
Why not simply inline the allowed methods insetMethod?
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 think I explained this sufficiently above.
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.
No, I don't see any valid reason against:
if (!in_array($upperCaseMethod, array('GET', 'PUT', 'POST', 'DELETE', 'PATCH'))) { throw new FormException(sprintf( 'The form method is "%s", but should be one of "GET", "PUT", "POST", "DELETE", "PATCH".', $method ));}jalliot commentedJan 3, 2013
What is the point of the |
webmozart commentedJan 3, 2013
@jalliot |
jalliot commentedJan 3, 2013
@bschussek Oh right sorry... I did not refresh my page and did not see the new commits. |
michelsalib commentedJan 5, 2013
Really nice work @bschussek. I like the way the form component is taking. There is still a lot of work, but hey, forms are a complex thing. |
webmozart commentedJan 8, 2013
Postponed to 2.3 |
webmozart commentedApr 13, 2013
Reviewed again and rebased on master. |
webmozart commentedApr 13, 2013
Again, the test failures on 5.3 seem unrelated to this PR. Reviewed and updated the documentation. |
stof commentedApr 13, 2013
@bschussek the fix for 5.3 has just been merged |
webmozart commentedApr 13, 2013
Rebased again. |
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.
IIRC when something will be removed in3.0, it should not throw error, right@fabpot ?
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.
You are right. We will trigger the error just before 3.0. For now, it should only be documented in the CHANGELOG for 3.0.
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.
Fixed
mvrhov commentedApr 17, 2013
I'm guessing that this still won't handle the case where you have the data for two forms present e.g. the http method is something different that GET, but the query part of the uri contains the data submitted in a search in a previous step. Right now you need to know the form name and get such a data from the request and then bind manually.... This becomes annoying and tedious if you need to persist this through more than one step... |
This PR was merged into the master branch.Discussion----------[2.3] [Form] Implemented form processorsBug fix: noFeature addition: yesBackwards compatibility break: noSymfony2 tests pass: yesFixes the following tickets: partially#5493Todo: -License of the code: MITDocumentation PR:symfony/symfony-docs#2092Commits-------11fee06 [TwigBridge] Removed duplicate entries from the CHANGELOG68f360c [Form] Moved upgrade nodes to UPGRADE-3.001b71a4 [Form] Removed trigger_error() for deprecations as of 3.081f8c67 [Form] Implemented form processors0ea75db [Form] Improved FormRenderer::renderBlock() to be usable outside of form blocks
stof commentedApr 19, 2013
@mvrhov the Form component is able to get the right data based on its name (since 2.0) |
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.
Well, submit buttons do support actions via "formaction" attribute. Also methods with "formmethod".
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.
Good point. Could you open a ticket please?
mvrhov commentedApr 19, 2013
@stof However in the action that gets executed on second step you need data from both form1 and form2 to complete the action. So calling |
webmozart commentedApr 19, 2013
@mvrhov IMO this is the wrong approach to the problem. You should not bind data that you already successfully submitted again. Instead, store the values somewhere in your session and write them into your persistence layer when you're done with the wizard. |
stof commentedApr 19, 2013
@mvrhov if you want to bind |
This PR was merged into the master branch.Discussion----------[Form] Deprecated bind() and isBound() in favor of submit() and isSubmitted()| Q | A| ------------- | ---| Bug fix? | no| New feature? | no| BC breaks? | yes (*)| Deprecations? | yes| Tests pass? | yes| Fixed tickets |#5493| License | MIT| Doc PR | TODOThis change was discussed for a while in#5493. **(*)** It breaks BC *only for people who implemented* `FormInterface` *manually* (not a lot, so I hope). These can fix the problem by simply renaming `bind()` and `isBound()` in their implementation to `submit()` and `isSubmitted()`.The main rationale is that with the request handlers introduced in#6522, people won't be confronted with the term "binding" anymore. As such, `isBound()` will be a very strange name to new users that have never used `bind()` manually.See this code sample as example:```php$form = $this->createForm(...);$form->handleRequest($request);// Imagine you have never heard about bind() or binding. What does this mean?if ($form->isBound()) { // ...}```In reality, `bind()` submits a form. Where-ever I renamed "bind" to "submit" in the comments, "submit" made actually much more sense. So it does in the code sample above:```php$form = $this->createForm(...);$form->handleRequest($request);// Aha!if ($form->isSubmitted()) { // ...}```Also when using `submit()` directly, the code makes much more sense now:```php$text = $this->createForm('text');$text->submit('New Value');```For current users, the current naming will be supported until 3.0.Commits-------41b0127 [Form] Deprecated bind() and isBound() in favor of submit() and isSubmitted()
….3 (xabbuh)This PR was merged into the 2.3 branch.Discussion----------[Component][Forms] add missing features introduced in 2.3| Q | A| ------------- | ---| Doc fix? | no| New docs? | yes (symfony/symfony#6522)| Applies to | all| Fixed tickets |#2969- [x] use ``submit()`` instead of ``bind()`` to manually submit a form- [x] configure method and action of a form- [ ] ~~render a form's start and its end separately~~ (see [the comment](#4085 (comment)))- [ ] configure buttonsCommits-------33f6422 [Forms] add missing features being new in 2.3
Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: partially#5493
Todo: -
License of the code: MIT
Documentation PR:symfony/symfony-docs#2092