Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[form] lazy transpost_max_size_message.#19595

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

Merged
fabpot merged 1 commit intosymfony:2.7fromaitboudad:form-upload-trans
Sep 6, 2016

Conversation

@aitboudad
Copy link
Contributor

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#19256
LicenseMIT
Doc PR~

HeahDude reacted with hooray emoji
}

/**
* This method is public because it needs to be callable from a closure in PHP 5.3.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

you can do without it by using a reference in theuse of the closure, wouldn't that be better?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

even better :), thanks


$form->addError(newFormError(
$form->getConfig()->getOption('post_max_size_message'),
(string)$form->getConfig()->getOption('post_max_size_message'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

could this be a bc break somehow?

Copy link
ContributorAuthor

@aitboudadaitboudadAug 13, 2016
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

not sure, but it can be treated as a string like the old ones

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

does it work if you remove the cast?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

just checked and I found that it can lead a bc break (if someone try to serialize this option)

@nicolas-grekas
Copy link
Member

@aitboudad any other idea to fix the linked issue that has no bc break inside?

return'form';
}

publicfunction__toString()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

-1 for making the TypeExtension itself castable to string as the error message. It looks really weird to me.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't like either :), but I was looking for a solution to avoid bc break

@aitboudad
Copy link
ContributorAuthor

Replacepost_max_size_message with a new optionupload_max_size_message that return a callable type is an alternative solution, what do you think ?

@nicolas-grekas
Copy link
Member

@aitboudad let's try :)

@aitboudadaitboudadforce-pushed theform-upload-trans branch 3 times, most recently from6f52062 to7797a16CompareAugust 24, 2016 12:05
@aitboudad
Copy link
ContributorAuthor

done

'action' =>'',
'attr' =>$defaultAttr,
'post_max_size_message' =>'The uploaded file was too large. Please try to upload a smaller file.',
'upload_max_size_message' =>$uploadMaxSizeMessage,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You could add// internal at the end of the line, and/or maybe add a comment somewhere explaining why you define it as a callable.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

just added a small description, can you look up ?

@HeahDude
Copy link
Contributor

Wow, great! Thanks for that fix!

};

// Derive "upload_max_size_message" closure from "post_max_size_message" option,
// to allow override or translate the message only when it's needed and not during the resolve `options`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think there are typo:overriding andtranslating.

What about something like:

// Wrap "post_max_size_message" in a closure to translate it lazily$uploadMaxSizeMessage ...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

good one, thanks!

@HeahDude
Copy link
Contributor

This one is very tricky :)

👍

Status: reviewed

@fabpot
Copy link
Member

Thank you@aitboudad.

@fabpotfabpot merged commitc03164e intosymfony:2.7Sep 6, 2016
fabpot added a commit that referenced this pull requestSep 6, 2016
This PR was merged into the 2.7 branch.Discussion----------[form] lazy trans `post_max_size_message`.| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#19256| License       | MIT| Doc PR        | ~Commits-------c03164e [form] lazy trans `post_max_size_message`.
@aitboudadaitboudad deleted the form-upload-trans branchSeptember 6, 2016 16:14
This was referencedSep 7, 2016
@fabpotfabpot mentioned this pull requestOct 3, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@aitboudad@nicolas-grekas@HeahDude@fabpot@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp