Skip to content
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

Use and display a file or image maxSize constraint if the value is lower than the server value #2759

Conversation

Projects
None yet
3 participants
@Senjutsuu
Copy link
Contributor

commented Feb 14, 2019

Type

  • Enhancement

Resolves the following issues

When a maxSize constraint is set for a file or image then the default argument text is still displayed as the server max filesize

Pull request description

Get the value of a maxSize constraint and compare it to the server max filesize setting from the php ini file. If the constraint is higher then the server value we use the server value otherwise we display and use the constraint value.

screen shot 2019-02-14 at 11 17 48

return $this->prettyPrintFileSize($serverValue);
}
private function prettyPrintFileSize(int $fileSize): string

This comment has been minimized.

Copy link
@ohvitorino

ohvitorino Feb 14, 2019

Contributor

Can't this function be placed in somewhere else since it's also be being used in ImageType?

@@ -23,3 +23,15 @@ services:
- "@translator"
tags:
- { name: form.type, alias: meta}
form.type.image:

This comment has been minimized.

Copy link
@carakas

carakas Feb 19, 2019

Member

Can you use the new format for this?

    Common\Form\ImageType:
        arguments:
            - "@validator"
        tags:
            - { name: form.type, alias: image}
@@ -23,3 +23,15 @@ services:
- "@translator"
tags:
- { name: form.type, alias: meta}
form.type.image:

This comment has been minimized.

Copy link
@carakas

carakas Feb 19, 2019

Member

can you use the class name as service name instead please?

- "@validator"
tags:
- { name: form.type, alias: image}
form.type.file:

This comment has been minimized.

Copy link
@carakas

@carakas carakas added this to the 5.6.0 milestone Feb 19, 2019

@carakas

This comment has been minimized.

Copy link
Member

commented Mar 12, 2019

@Senjutsuu can you take a look at the feedback?

@carakas

carakas approved these changes Apr 3, 2019

@carakas

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

Thank you, looks good 💯

@carakas carakas merged commit 0a99e89 into forkcms:master May 21, 2019

3 checks passed

Scrutinizer Analysis: 2 new issues, 11 updated code elements – Tests: passed
Details
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.