8000 [Form] Form should not swallow TransformationFailedException. by dtee · Pull Request #703 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Form should not swallow TransformationFailedException. #703

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

Closed
wants to merge 1 commit into from
Closed

[Form] Form should not swallow TransformationFailedException. #703

wants to merge 1 commit into from

Conversation

dtee
Copy link
@dtee dtee commented Apr 29, 2011
  1. Added useful information to form view - original child form name (before the concatenation with parent ids).
  2. Form needs to throw exception when Transform fails. (or log the exception)

Example: add date type to form, set date_default_timezone_set('America/Pacific'), DateTimeToArrayTransformer will fail at new \DateTime() - line 148.

  • Maybe a better way to handle this is
    1. call addError(), so that developer can figure out what went wrong. Right now, DefaultValidator will return "The value is invalid".
    2. DateTimeToArrayTransformer should check the $outputTimezone to see if it valid first before using it blindly.

TransformationFailedException() exceptions are thrown with a lot of information and

…ful information to form view - original child form name (before the concatenation with parent ids).' did not match any file(s) known to git
@ghost ghost assigned webmozart May 3, 2011
@webmozart
Copy link
Contributor

I agree that we need form errors that relate to the kind of transformation error that was thrown. But rethrowing the exception is no solution. Can you open a ticket for this?

What is the use case for your "form_name" variable?

@dtee
Copy link
Author
dtee commented May 4, 2011

Example of the use case is here:

url: http://wooshed.com/game-create

source: https://github.com/dtee/ShadowBundle/blob/master/Resources/views/Form/fields_game.html.twig

Given Game Object, which could have many players. Using the formbuilder would result in the player's form name changed to game[index][fieldname]. It's nice to have just the name so that you can assign it to class, and use javascript to hide select certain field(s).

@webmozart
Copy link
Contributor

f467317 now contains what you're looking for in the "name" variable. The old "name" variable was renamed to "full_name".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0