Skip to content

Update without_class.rst #20487

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 2 commits into from
Closed

Conversation

issamkhadiri1989
Copy link
Contributor

@issamkhadiri1989 issamkhadiri1989 commented Dec 19, 2024

hello

when trying to add several validation constraints (setup an array of constraints for a given form field) in the Constraints At Class Level, an error is raised as described in the following screenshot :

image

Symfony version : 7.2.1
PHP version : 8.2.20

Steps to reproduce the bug:

Step 1

create a controller like described in the doc

image

Step 2

render the form

image

Step 3

Go to the page http://localhost/contact

the error is raised

image

to make sure that the problem is coming from the

'lastName' => [
    new NotBlank(),
    new Length(['min' => 3]),
],

change this configuration by either remove the entire config or just do

'lastName' =>new NotBlank(),

(use Constraint instead of an array)

and the result is as follows

image

the form is rendered with no problems

thanks in advance,

@carsonbot carsonbot added this to the 7.3 milestone Dec 19, 2024
@abdosql
Copy link

abdosql commented Dec 20, 2024

I was able to reproduce the bug, and I encountered the same issue.

@MatTheCat
Copy link
Contributor

MatTheCat commented Dec 31, 2024

I think you can update your PR by reverting #19094 and targeting the 6.4 branch.

@xabbuh
Copy link
Member

xabbuh commented Jan 8, 2025

I opened #20547 to fix this, thanks for making it aware of this mistake @issamkhadiri1989

@xabbuh xabbuh closed this Jan 8, 2025
javiereguiluz added a commit that referenced this pull request Jan 9, 2025
…int to validate array-like data (xabbuh)

This PR was merged into the 6.4 branch.

Discussion
----------

[Form] wrap multiple constraints in a Collection constraint to validate array-like data

fixes symfony/symfony#59332, replaces #20487

see also #18969 (comment)

Commits
-------

6e71ed0 wrap multiple constraints in a Collection constraint to validate array-like data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants