Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Validator] Add support for closures inWhen
#59800
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
89d2237
toa33d9c4
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
a33d9c4
tof0adbea
CompareUh oh!
There was an error while loading.Please reload this page.
Wouldn't this break when caching the constraint metadata as the closure is not serializable ? |
I'm not familiar with validator cache at all, where could this possibly be a problem? I couldn't break the current code when using the |
Looks like this option is a no-op@alexandre-daubois - it's of no use since Symfony 4 apparently. |
That being said, it shouldn't break anything because |
Failing silently might still be an issue, in case the following requests consider that there is no constraints for that property (due to the failed save of the cache) instead of considering they must reload metadata without cache. And not having a metadata cache in prod will be bad for performance. |
Reflection is fast nowadays, I'm not sure a cache is going to be faster than reading attributes. |
@nicolas-grekas validator metadata is not only coming from attributes. We still have loaders for XML and Yaml config files (and maybe also others). |
… config option (alexandre-daubois)This PR was merged into the 7.3 branch.Discussion----------[Framework] Deprecate the `framework.validation.cache` config option| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | no| New feature? | no| Deprecations? | yes| Issues |#59800 (comment)| License | MITThe option is no-op, I think we should deprecate itCommits-------b7e4074 [Framework] Deprecate the `framework.validation.cache` config option
Yes, Cache's I'm not sure how we could skip trying to save. It seems very specific to this constraint (and Callback which should already supports closures-in-attribute I think) and it does not look like it worths it in the end?
Seems that |
Great, so good to merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice
Thank you@alexandre-daubois. |
dfd8e53
intosymfony:7.3Uh oh!
There was an error while loading.Please reload this page.
Closures can be used instead of Expressions in the
When
constraint since PHP 8.5, like in this example: