Skip to content

Conversation

@mboelsterli
Copy link
Contributor

The function must be static or the callable needs the object instead of class name.

@carsonbot carsonbot changed the title Wrong callable in async cache computation example Wrong callable in async cache computation example Nov 21, 2025
@nicolas-grekas
Copy link
Member

I suppose the issue is also on 6.4?
It'd go the other way: show how to make this work with a service.
This means using $this in the callback, and also ensure that the container.reversible tag is set on the class. With an AutoconfigureTag attribute?

@mboelsterli
Copy link
Contributor Author

Yes, the issue is also on 6.4.

I've got it working (locally) with a service but this is not working in the dev environment, because of the TraceableAdapter, which wraps the callback in a closure, which is not reversible: https://github.com/symfony/cache/blob/8095968c141288581c6a4dd84ddaeb7920118d22/Adapter/TraceableAdapter.php#L54

If this is a known behave, this should be mentioned in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants