Skip to content

[Validator] Breaking changes in Collection #53455

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy