symfony-docs icon indicating copy to clipboard operation
symfony-docs copied to clipboard

POST_SUBMIT_EVENT improvement?

Open DonCallisto opened this issue 4 years ago • 6 comments

Reading https://symfony.com/doc/current/form/events.html#c-the-formevents-post-submit-event, even if it's true that's clearly stated

It can be used to fetch data after denormalization.

it is, correctly, just an advice. No one prevents the user to set data directly on the underlying form object (after some logic applied, for example?). This will result possibly in a validation happening before new data taking place as ValidationListener has no priority declared (https://github.com/symfony/form/blob/master/Extension/Validator/EventListener/ValidationListener.php#L35).

Proposal

Warn explicitly the user, through the doc page, about this eventuality. If this makes sense to you, let me know and I'll make a PR.

PS.: I was wondering if ValidationListener has the right behaviour: as long as form component can't prevent someone to modify data after validation (and that's not possible at all), ValidationListener should be registered with PHP_MAX_INT priority (minus 1, in order to let someone to act before data validation?) to take shelter of this kind of issues. I think it would be a good idea because, as this component is designed, validation is "automatically" done by component itself so, as long as validation is expected, why shouldn't we care when it actually happens? It makes sense?

DonCallisto avatar Dec 20 '19 15:12 DonCallisto

Did anyone had the chance to look at this?

DonCallisto avatar May 27 '20 10:05 DonCallisto

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar May 28 '21 12:05 carsonbot

Still waiting for a feedback

DonCallisto avatar May 28 '21 13:05 DonCallisto

@DonCallisto Please open a PR. We can discuss the proper wording there. :)

xabbuh avatar Jul 08 '21 08:07 xabbuh

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Jul 09 '22 12:07 carsonbot

Hello? This issue is about to be closed if nobody replies.

carsonbot avatar Aug 28 '22 14:08 carsonbot

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

carsonbot avatar Oct 29 '22 14:10 carsonbot