Skip to content
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

fix(validator): allow to pass both a ConstraintViolationList and a previous exception #6762

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

xavierlacot
Copy link
Contributor

@xavierlacot xavierlacot commented Oct 28, 2024

Q A
Branch? 3.4
Tickets
License MIT
Doc PR

When a ApiPlatform\Validator\Exception\ValidationException is created with a ConstraintViolationList and a $previous exception, the current constructor breaks on

parent::__construct($code ?? $this->__toString(), $previous ?? 0, $errorTitle instanceof \Throwable ? $errorTitle : null);

with the following error:

TypeError: Exception::__construct(): Argument #2 ($code) must be of type int, Exception given

@xavierlacot xavierlacot changed the title fix(valdator): allow to pass both a ConstraintViolationList and a previous exception fix(validator): allow to pass both a ConstraintViolationList and a previous exception Oct 28, 2024
Copy link
Member

@soyuka soyuka left a comment

Choose a reason for hiding this comment

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

Nice thanks!

@soyuka soyuka merged commit 736ca04 into api-platform:3.4 Oct 30, 2024
76 of 78 checks passed
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.

2 participants