Thanks to visit codestin.com
Credit goes to github.com

Skip to content

managed nested validation context #18212

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

Open
wants to merge 3 commits into
base: 5.x
Choose a base branch
from
Open

managed nested validation context #18212

wants to merge 3 commits into from

Conversation

doshu
Copy link

@doshu doshu commented Feb 27, 2025

added to the validator context, information about parent data for nested validator
this pull request is related to issue #17705

@markstory markstory added this to the 5.1.7 milestone Mar 3, 2025
Copy link
Member

@markstory markstory left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together. Your changes have caused a few existing tests to fail, and before we can get this merged in we'll need to add some additional tests. If you need a hand with tests I can help, but I could use a hand in understanding how you see this logic being used.

* @return array<string, mixed>
*/
protected function _processRules(string $field, ValidationSet $rules, array $data, bool $newRecord): array
protected function _processRules(string $field, ValidationSet $rules, mixed $value, array $context): array
Copy link
Member

Choose a reason for hiding this comment

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

We generally reserved changes in protected methods for minor releases as they can cause application failures.

Copy link
Member

Choose a reason for hiding this comment

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

I have a custom validator overriding this method.

Copy link
Author

Choose a reason for hiding this comment

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

probably the only method for not overriding the _processRules signature is to implement a stack of contexts and retrieve it int the method.

@markstory markstory modified the milestones: 5.1.7, 5.2.1 Mar 29, 2025
@markstory markstory modified the milestones: 5.2.1, 5.2.2 Apr 6, 2025
@markstory markstory modified the milestones: 5.2.2, 5.2.3, 5.2.4 Apr 18, 2025
@markstory markstory modified the milestones: 5.2.4, 5.2.5 May 17, 2025
@markstory markstory modified the milestones: 5.2.5, 5.2.6 Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants