Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf44cb14

Browse files
committed
[FrameworkBundle] Deprecate framework.serializer.cache
1 parenteccbffb commitf44cb14

File tree

11 files changed

+134
-16
lines changed

11 files changed

+134
-16
lines changed

‎UPGRADE-3.1.md‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ Form
1919
* Support for data objects that implements both`Traversable` and`ArrayAccess`
2020
in`ResizeFormListener::preSubmit` method has been deprecated and will be
2121
removed in Symfony 4.0.
22-
22+
2323
* Using callable strings as choice options in ChoiceType has been deprecated
2424
in favor of`PropertyPath` in Symfony 4.0 use a "\Closure" instead.
25-
25+
2626
Before:
27-
27+
2828
```php
2929
'choice_value' => new PropertyPath('range'),
3030
'choice_label' => 'strtoupper',
3131
```
32-
32+
3333
After:
34-
34+
3535
```php
3636
'choice_value' => 'range',
3737
'choice_label' => function ($choice) {
@@ -88,6 +88,27 @@ FrameworkBundle
8888
cache service. If you are using`serializer.mapping.cache.apc`, use
8989
`serializer.mapping.cache.doctrine.apc` instead.
9090

91+
* The`framework.serializer.cache` option has been deprecated. Configure a cache pool
92+
called`serializer` under`framework.cache.pools` instead.
93+
94+
Before:
95+
96+
```yaml
97+
framework:
98+
serializer:
99+
cache:serializer.mapping.cache.apc
100+
```
101+
102+
After:
103+
104+
```yaml
105+
framework:
106+
serializer:~
107+
cache:
108+
pools:
109+
serializer:
110+
adapter:cache.adapter.apcu
111+
91112
HttpKernel
92113
----------
93114

‎UPGRADE-4.0.md‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ Form
1616

1717
* Support for data objects that implements both`Traversable` and
1818
`ArrayAccess` in`ResizeFormListener::preSubmit` method has been removed.
19-
20-
* Using callable strings as choice options in ChoiceType is not supported
19+
20+
* Using callable strings as choice options in ChoiceType is not supported
2121
anymore in favor of passing PropertyPath instances.
22-
22+
2323
Before:
24-
24+
2525
```php
2626
'choice_value' => new PropertyPath('range'),
2727
'choice_label' => 'strtoupper',
2828
```
29-
29+
3030
After:
31-
31+
3232
```php
3333
'choice_value' => 'range',
3434
'choice_label' => function ($choice) {
3535
return strtoupper($choice);
3636
},
3737
```
38-
38+
3939

4040
FrameworkBundle
4141
---------------
@@ -78,6 +78,28 @@ FrameworkBundle
7878
* The service`serializer.mapping.cache.apc` has been removed; use
7979
`serializer.mapping.cache.doctrine.apc` instead.
8080

81+
* The`framework.serializer.cache` option has been removed. Configure a cache pool
82+
called`serializer` under`framework.cache.pools` instead.
83+
84+
Before:
85+
86+
```yaml
87+
framework:
88+
serializer:
89+
cache:serializer.mapping.cache.apc
90+
```
91+
92+
After:
93+
94+
```yaml
95+
framework:
96+
serializer:~
97+
cache:
98+
pools:
99+
serializer:
100+
adapter:cache.adapter.apcu
101+
```
102+
81103
HttpKernel
82104
----------
83105

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
useSymfony\Component\Finder\Finder;
2525
useSymfony\Component\HttpKernel\DependencyInjection\Extension;
2626
useSymfony\Component\Config\FileLocator;
27+
useSymfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
2728
useSymfony\Component\Serializer\Normalizer\DataUriNormalizer;
2829
useSymfony\Component\Serializer\Normalizer\DateTimeNormalizer;
2930
useSymfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
@@ -983,6 +984,8 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
983984
$chainLoader->replaceArgument(0,$serializerLoaders);
984985

985986
if (isset($config['cache']) &&$config['cache']) {
987+
@trigger_error('The "framework.serializer.cache" option is deprecated since Symfony 3.1 and will be removed in 4.0. You can configure a cache pool called "serializer" under "framework.cache.pools" instead.',E_USER_DEPRECATED);
988+
986989
$container->setParameter(
987990
'serializer.mapping.cache.prefix',
988991
'serializer_'.$this->getKernelRootHash($container)
@@ -991,6 +994,18 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
991994
$container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument(
992995
1,newReference($config['cache'])
993996
);
997+
}elseif (!$container->getParameter('kernel.debug')) {
998+
$cacheMetadataFactory =newDefinition(
999+
CacheClassMetadataFactory::class,
1000+
array(
1001+
newReference('serializer.mapping.class_metadata_factory.inner'),
1002+
newReference('cache.pool.serializer'),
1003+
)
1004+
);
1005+
$cacheMetadataFactory->setPublic(false);
1006+
$cacheMetadataFactory->setDecoratedService('serializer.mapping.class_metadata_factory');
1007+
1008+
$container->setDefinition('serializer.mapping.cache_class_metadata_factory',$cacheMetadataFactory);
9941009
}
9951010

9961011
if (isset($config['name_converter']) &&$config['name_converter']) {

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_pools.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<tagname="cache.pool"clearer="cache.default_pools_clearer" />
2626
</service>
2727

28+
<serviceid="cache.pool.serializer"parent="cache.adapter.local"public="false">
29+
<tagname="cache.pool"clearer="cache.default_pools_clearer" />
30+
</service>
31+
2832
<serviceid="cache.adapter.apcu"class="Symfony\Component\Cache\Adapter\ApcuAdapter"abstract="true">
2933
<argument /><!-- namespace-->
3034
<argument /><!-- default lifetime-->

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
'serializer' =>array(
6767
'enabled' =>true,
6868
'enable_annotations' =>true,
69-
'cache' =>'serializer.mapping.cache.doctrine.apc',
7069
'name_converter' =>'serializer.name_converter.camel_case_to_snake_case',
7170
),
7271
'ide' =>'file%%link%%format',
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework',array(
4+
'serializer' =>array(
5+
'enabled' =>true,
6+
'cache' =>'foo',
7+
),
8+
));

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
</framework:translator>
4141
<framework:validationenabled="true"cache="validator.mapping.cache.doctrine.apc" />
4242
<framework:annotationscache="file"debug="true"file-cache-dir="%kernel.cache_dir%/annotations" />
43-
<framework:serializerenabled="true"enable-annotations="true"cache="serializer.mapping.cache.doctrine.apc"name-converter="serializer.name_converter.camel_case_to_snake_case" />
43+
<framework:serializerenabled="true"enable-annotations="true"name-converter="serializer.name_converter.camel_case_to_snake_case" />
4444
</framework:config>
4545
</container>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<containerxmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:serializerenabled="true"cache="foo"/>
10+
</framework:config>
11+
</container>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ framework:
5252
serializer:
5353
enabled:true
5454
enable_annotations:true
55-
cache:serializer.mapping.cache.doctrine.apc
5655
name_converter:serializer.name_converter.camel_case_to_snake_case
5756
ide:file%%link%%format
5857
request:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework:
2+
serializer:
3+
enabled:true
4+
cache:foo

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp