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

[DoctrineBridge] In Profiler, Show all fields and values for validation constraints#57963

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

Open
eltharin wants to merge6 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromeltharin:show_all_fields_and_values_for_validation_constraints

Conversation

eltharin
Copy link
Contributor

@eltharineltharin commentedAug 9, 2024
edited
Loading

QA
Branch?7.2
Bug fix?no
New feature?yes
Deprecations?no
LicenseMIT

When using UniqueEntity with multiple fields, show all fields and all values in profiler for debug quickly.
Before only one value was shown :

image
in form errors :
image

After we have all fields :
image
and in the form, error is not attached to a field but to the top form :
image

Copy link
Member

@alexandre-dauboisalexandre-daubois left a comment

Choose a reason for hiding this comment

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

As it touches the Profiler, would it be possible to have a screenshot showing the before/after? 🙂

andreybolonin reacted with thumbs up emoji
@@ -207,16 +207,25 @@ public function validate(mixed $value, Constraint $constraint): void
}
}

$errorPath = $constraint->errorPath ?? current($fields);
$invalidValue = $criteria[$errorPath] ?? $criteria[current($fields)];
$errorPath = $constraint->errorPath ?? implode(', ', array_keys($criteria));
Copy link
Member

Choose a reason for hiding this comment

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

This change will break the integration into the Form component as the error now can no longer be mapped back to the corresponding form type.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

if one field, error stay on field, but if there are many fields, error go on top form instead one arbitrary field

Choose a reason for hiding this comment

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

it'd be great to have a test case that covers the issue that@xabbuh spotted here

Copy link
Member

Choose a reason for hiding this comment

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

Thinking about this PR again I'd say if we were to change anything here the constraint could accept theerrorPath option to be configured as an array which would lead to the violation being added to all these property paths. But doing the suggested change is a no go to me as it breaks the Form integration as explained.

Copy link
ContributorAuthor

@eltharineltharinAug 17, 2024
edited by OskarStark
Loading

Choose a reason for hiding this comment

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

add to all property can be OK but can create backward compatibility breaks,
but actually we have violation on only one field is not good, it's not A field whitch is bad but a group,
if you set firstname and lastname unique, form will respond to you "firstname is incorrect Christian is already used".
That's why put this to the parent form instead one field is preferable.
I think.
I'm trying to do tests and I'll look for an array (or an object stringable) for errorPath

@carsonbotcarsonbot changed the titleIn Profiler, Show all fields and values for validation constraints[DoctrineBridge] In Profiler, Show all fields and values for validation constraintsAug 16, 2024
@eltharineltharinforce-pushed theshow_all_fields_and_values_for_validation_constraints branch fromd485469 to8a7e593CompareSeptember 16, 2024 19:28
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@eltharineltharinforce-pushed theshow_all_fields_and_values_for_validation_constraints branch from8924462 to4d08d19CompareJanuary 9, 2025 20:26
@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@alexandre-dauboisalexandre-dauboisAwaiting requested review from alexandre-daubois

@xabbuhxabbuhAwaiting requested review from xabbuh

@nicolas-grekasnicolas-grekasAwaiting requested review from nicolas-grekas

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

7 participants
@eltharin@nicolas-grekas@xabbuh@alexandre-daubois@fabpot@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp