Skip to content

[Validator] Please don't remove minMessage/maxMessage for Range Constraint #39960

@bartrail

Description

@bartrail

Not sure if this is the right place/ticket type for it.

Description
I recently discovered that the usage of minMessage and maxMessage of the Range Constraint is deprecated and should not be used anymore.

As a little more background, I "discovered" that you can still use minMessage and maxMessage even if both min and max parameters are given for the constraint, and it was "just not documented". This was the reason I opened this PR for the symfony docs.

During the discussion with @xabbuh told me that the usage of this is deprecated and @OskarStark encouraged me to open this discussion here to share my thoughts about it.

I am opening this ticket because I'd like to say that it's quite useful that I can choose to only show a minMessage (including the provided min value) or a maxMessage (including the provided max value) or a notInRangeMessage (including both min and max value) in the returning message even if both min and max values are set in the constraint.

I might have missed the original discussion that led to deprecating this behaviour in the Range constraint but I think it's a really useful, smart feature that doesn't bring any harm. Plus the Length constraint behaves in a similar fashion.

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