Skip to content
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

Do not disable cache in dev #2629

Merged
merged 1 commit into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,21 @@ private function registerBundlesConfiguration(array $bundles, array $config, Xml
*/
private function registerCacheConfiguration(ContainerBuilder $container)
{
// Don't use system cache pool in dev
if ($container->hasParameter('api_platform.metadata_cache') ? $container->getParameter('api_platform.metadata_cache') : !$container->getParameter('kernel.debug')) {
if (!$container->hasParameter('api_platform.metadata_cache')) {
return;
}

$container->register('api_platform.cache.metadata.property', ArrayAdapter::class);
$container->register('api_platform.cache.metadata.resource', ArrayAdapter::class);
$container->register('api_platform.cache.route_name_resolver', ArrayAdapter::class);
$container->register('api_platform.cache.identifiers_extractor', ArrayAdapter::class);
$container->register('api_platform.cache.subresource_operation_factory', ArrayAdapter::class);
$container->register('api_platform.elasticsearch.cache.metadata.document', ArrayAdapter::class);
@trigger_error('The "api_platform.metadata_cache" parameter is deprecated since version 2.4 and will have no effect in 3.0.', E_USER_DEPRECATED);

// BC
if (!$container->getParameter('api_platform.metadata_cache')) {
$container->register('api_platform.cache.metadata.property', ArrayAdapter::class);
$container->register('api_platform.cache.metadata.resource', ArrayAdapter::class);
$container->register('api_platform.cache.route_name_resolver', ArrayAdapter::class);
$container->register('api_platform.cache.identifiers_extractor', ArrayAdapter::class);
$container->register('api_platform.cache.subresource_operation_factory', ArrayAdapter::class);
$container->register('api_platform.elasticsearch.cache.metadata.document', ArrayAdapter::class);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,7 @@ private function getBaseContainerBuilderProphecy()
$containerBuilderProphecy->setAlias($alias, $service)->shouldBeCalled();
}

$containerBuilderProphecy->hasParameter('api_platform.metadata_cache')->willReturn(true)->shouldBeCalled();
$containerBuilderProphecy->getParameter('api_platform.metadata_cache')->willReturn(true)->shouldBeCalled();
$containerBuilderProphecy->hasParameter('api_platform.metadata_cache')->willReturn(false);

$containerBuilderProphecy->getDefinition('api_platform.mercure.listener.response.add_link_header')->willReturn(new Definition());

Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/app/config/config_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ api_platform:
parameters:
container.autowiring.strict_mode: true
container.dumper.inline_class_loader: true
# Enable the metadata cache to speedup the builds
api_platform.metadata_cache: true

services:
contain_non_resource.item_data_provider:
Expand Down