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

Appearance settings

[Validator] [Twig] added magic method __isset to File Constraint class #24512

Copy link
Copy link
Closed
@loru88

Description

@loru88
Issue body actions
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version all

In my project I get assert constraints from one of my entity and I use this value in my front end via Twig.
I faced a problem with the property $maxSize of the File Constraint.

As this property is protected I cannot access it via Twig because the magic method __isset is missing, as I read in twig documentation.

so I propose to add this piece of code to be able to get this value accessible in Twig:

    public function __isset($option)
    {
        if ('maxSize' === $option) {
            return true;
        }

        return parent::__isset($option);
    }

this solution work for sure as I tested it, but my question is why this is not a simple public property as the rest of the File Constraint class properties?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.