Skip to content

Dataset is not passed to context in StopOnError() #822

Description

@jettero777

Description

Current scope's dataset is not set in context inside StopOnError():

'property' => [
    new Callback(
        function (mixed $value, Callback $rule, ValidationContext $context): Result {
            $context->getDataSet()->getData(); // <= dataset array
        }
    ),
    new StopOnError([
        new Callback(
            function (mixed $value, Callback $rule, ValidationContext $context): Result {
                $context->getDataSet()->getData(); // <= null (bug)
            }
        ),
    ]),
]

this could be worked around using $context->getGlobalDataSet() and extracting data from there,
but it would be not possible in case if multiple nested Each() used, because in context parameters there is index for the last Each() only

Package version

No response

PHP version

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions