-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebProfilerBundle][Form] Add information about form synchronization err... #11487
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
Epic 👍 sometimes you get a failed transformation because your not using some internal stuff correctly. And its really hard to debug such cases. |
@@ -134,6 +135,10 @@ public function extractSubmittedData(FormInterface $form) | |||
|
|||
$data['synchronized'] = $this->valueExporter->exportValue($form->isSynchronized()); | |||
|
|||
if ($form instanceof Form && $form->getSynchronizationFailureCause() !== null) { |
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.
Small detail: we are using null !== xxx
in Symfony.
Looks like a great idea. @webmozart Can you check the implementation? |
To make it even more obvious, what about changing the color to red in the toolbar itself (and probably increment the error count to 1 in this case)? |
…error to profiler
ok, error count in toolbar and in form panel is incremented by 1 for every transformation failure. |
} | ||
|
||
/** | ||
* @return TransformationFailedException |
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.
TransformationFailedException|null
I thought about do that in simillar way as you, but I realized there would be BC-break so I decided to do that in less invasively way. If BC-break is acceptable in that situation, your solution is more elegant and flexible ;) |
When form data transformation fails, the origin error message is lost. This error shouldn't be shown to user, because this is technical error, so maybe a good idea is to show transformation failures in web profiler in
form
panel belowerrors
section?There are no BC-breaks in this PR, I have added public internal method to
Symfony\Component\Form\Form
class, that returnsTransformationFailedException
, it is used byFormDataExtractor
.Symfony\Component\Form\FormInterface
has not been touched by me, because that would be a BC-break.