It's not actually a bug. To cache jms metadata the Metadata\ClassMetadata\FileCache class is used. Symfony doesn't know about this metadata cache and can't clear it.
To clear the jms metadata cache by cache:clear command you need to wrap the built-in Symphony cache with PsrCacheAdapter
# config/packages/jms_serializer.yaml
services:
jms.metadata_cache:
class: Metadata\Cache\PsrCacheAdapter
arguments: ["cache_app_jms_metadata_%kernel.environment%", "@cache.app"]
jms_serializer:
metadata:
cache: jms.metadata_cache
From these two facts, it's too obvious to expect the bundle cache to be cleared by a standard Symfony cache clearing command. You don't run a separate cache clearing command for each bundle you have in your project.
But the bundle cache can neither be cleared by Symfony's standard cache clearing command nor the bundle has its own command to clear the cache. The only workaround is to write an undocumented config modification.
Now, I would really appreciate if you could logically explain to me how is this not a bug.
thank you
Most helpful comment
fixed by https://github.com/schmittjoh/JMSSerializerBundle/pull/839