Closed ts-navghane closed 2 years ago
Yeah, I had the same problem. Had to set cache: file
to push forward.
I did a workaround this:
Created a custom JMSNoneCache class and mentioned it as a service with key jms.none.cache
:
<?php
use Metadata\Cache\CacheInterface;
use Metadata\Cache\ClearableCacheInterface;
use Metadata\ClassMetadata;
class JMSNoneCache implements CacheInterface, ClearableCacheInterface
{
public function load(string $class): ?ClassMetadata
{
return null;
}
public function put(ClassMetadata $metadata): void
{
return;
}
public function evict(string $class): void
{
return;
}
public function clear(): bool
{
return true;
}
}
Used jms_serializer[metadata][config] => 'jms.none.cache'. This works for now.
Since https://github.com/schmittjoh/JMSSerializerBundle/pull/900 is merged, is this solved now?
I will let you know when go back to the branch where I'm upgrading JMS.
@goetas It works. Thank you a lot.
In "jms/serializer-bundle" - 4.0.2, https://github.com/schmittjoh/JMSSerializerBundle/blob/4.0.2/DependencyInjection/JMSSerializerExtension.php#L99-L101 the cache service is removed from the container if the cache config value is none, but jms_serializer.metadata.traceable_cache has dependency on jms_serializer.metadata.cache. https://github.com/schmittjoh/JMSSerializerBundle/blob/4.0.2/Resources/config/debug.xml#L31-L36.
Thus it gives error
The service "jms_serializer.metadata.traceable_cache" has a dependency on a non-existent service "jms_serializer.metadata.cache".
when we warmup the cache or simply do bin/console.Steps required to reproduce the problem
Expected Result
Actual Result
The service "jms_serializer.metadata.traceable_cache" has a dependency on a non-existent service "jms_serializer.metadata.cache".
Versions
PHP - 7.4.30 Symfony - 4.4.0 jms/serializer-bundle - 4.0.2