-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Callback constraint with Closure cannot be serialized #10083
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
Comments
since it is data dependent or at least it seems, could you please tell us details about which country or try to reproduce it? It seems this site is russian ... would need a SE fork reprod 8000 uction |
I will try make fork but this issue is very hard reproducible. Maybe somewho guess where the problem could be... |
It seems to be a Sonata Admin issue. As @Koc, this problem occurs only on one of my entities. |
But Symfony has |
// cc @webmozart |
Yes but a Closure cannot be set in configuration (YAML, annotation or XML) but only in PHP code so it won't be cached. I saw that the problem could come from the recursion in
For a reason I don't know,
I think this problem occurs because my entity has a ManyToOne association which is referencing back this entity.
So this issue is not a SonataAdminBundle one but concerns the cache mechanism. Maybe the metadata should not cache constraints directly added in PHP code? I hope to be clear. |
The following change for Symfony 2.3 fixes this:
|
i.e. cache directly after loading and look for parents later. not sure if this breaks anything substantial |
@uwej711 your proposal breaks the caching: given that you don't merge the parent constraint before caching, you need to update the code reading the cache so that merging parents is done after loading the cache too. |
Yes, you are right. |
So rather this way:
Note: the order of the constraints change:
|
Replaced by #12302. |
This is very strange issue. There is edit form for
Country
entities and on one of entity this occurs.I don't know how it possible to reproduce it on small test case. The problem is PDO instance and closures stores in the Apc cache when parsing metadata.
The text was updated successfully, but these errors were encountered: