8000 [Validator] Breaking changes in Collection · Issue #53455 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Validator] Breaking changes in Collection #53455
Closed
@axzx

Description

@axzx

Symfony version(s) affected

5.4

Description

Before this symfony/validator@b125357

$violations = $this->validator->validate(
            $input,
            new Assert\Collection([
                'channelName' => null,
                'reportType' => null,
                'period' => new Assert\Choice(
                    choices: (new CreateReportScheduleSpecification())->getPeriodAllowableValues(),
                ),
            ]),
        );

After this symfony/validator@b125357

$violations = $this->validator->validate(
            $input,
            new Assert\Collection([
                'fields' => [
                    'channelName' => null,
                    'reportType' => null,
                    'period' => new Assert\Choice(
                        choices: (new CreateReportScheduleSpecification())->getPeriodAllowableValues(),
                    ),
                ],
            ]),
        );

@nicolas-grekas My application stopped working as before after this commit.

How to reproduce

$input = [
            'channelName' => $input->getArgument('channelName'),
            'reportType' => $input->getArgument('reportType'),
            'period' => $input->getArgument('period'),
        ];

$violations = $this->validator->validate(
            $input,
            new Assert\Collection([
                'channelName' => null,
                'reportType' => null,
                'period' => new Assert\Choice(
                    choices: (new CreateReportScheduleSpecification())->getPeriodAllowableValues(),
                ),
            ]),
        );

Possible Solution

No response

Additional Context

No response

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

      0