-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Fix caching of constraints derived from non-serializable parents #20793
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
Conversation
This change allows to still cache constraints even when an uncachable constraint (i.e. Callback) is added to a parent class at runtime. This is achived by caching only the constraints that are loaded for the class in question only and merging parent and interface constraints after reading from cache.
The Travis error looks related to your patch. |
Had only PHP 5.5 to test locally ... |
Oh dear, to early in the morning to spot the same two lines further down ... |
return $this->loadedClasses[$class] = $metadata; | ||
} | ||
|
||
private function mergeConstraints(ClassMetadata $metadata) |
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.
I think I would use a name like mergeConstraintFromParentClasses()
.
@uwej711 The change itself looks good to me. However, this will only solve the issue mentioned in #12302 (comment), right? |
looks good to me. 👍 |
👍 |
Thank you @uwej711. |
…rializable parents (uwej711) This PR was squashed before being merged into the 2.7 branch (closes #20793). Discussion ---------- [Validator] Fix caching of constraints derived from non-serializable parents | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #12302 | License | MIT | Doc PR | - This change allows to still cache constraints even when an uncachable constraint (i.e. Callback) is added to a parent class at runtime. This is achived by caching only the constraints that are loaded for the class in question only and merging parent and interface constraints after reading from cache. Commits ------- 9dd6b0c [Validator] Fix caching of constraints derived from non-serializable parents
This change allows to still cache constraints even when an uncachable constraint (i.e. Callback)
is added to a parent class at runtime.
This is achived by caching only the constraints that are loaded for the class in question only
and merging parent and interface constraints after reading from cache.