Skip to content

Context doesn't allow access to nested data #752

Description

@tomaszkane

What steps will reproduce the problem?

publicfunctiongetRules(): array
{
return [
'submitForVerification' => [
newRequired,
newBooleanValue,
],
'tasks' => [
newEach(
newNested([
'push' => [
newNested([
'isEnabled' => [
newRequired(when: fn() => $this->submitForVerification),
newBooleanValue,
],
'content' => [
newRequired(when: [???]),
],
])
],
])
)
],
];
}

What is the expected result?

I can set Required validator for content dependent on his sibling isEnabled value.

What do you get instead?

It cannot be done? Or it'll be ugly solution.

Additional info

QA
Version2.1.x
PHP version8.2
Telegram messagehttps://t.me/yii3en/10708

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