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

Appearance settings

Commit 3a57de1

Browse filesBrowse files
bug #19434 [Serializer] enable property info in framework bundle (David Badura)
This PR was submitted for the master branch but it was merged into the 3.1 branch instead (closes #19434). Discussion ---------- [Serializer] enable property info in framework bundle | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - I've been wondering why the datetime normalizer won't work in combination with object normalizer in symfony 3.1 by default. I also found nothing in the documentation. Only http://symfony.com/blog/new-in-symfony-3-1-datetime-normalizer but here is not described how to use it with the object normalizer and how to configure the config.yml. After debugging i found out that the object normalizer don't use the new property info component. With my change, you can enabled it with following config: ```yml serializer: enabled: true property_info: ~ ``` Should i add analog to `enable_annotation` an `enable_property_info` option? ```yml serializer: enabled: true enable_property_info: true property_info: ~ ``` Commits ------- c02933d enable property info
2 parents 90e95a6 + c02933d commit 3a57de1
Copy full SHA for 3a57de1

File tree

5 files changed

+5
-0
lines changed
Filter options

5 files changed

+5
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<argument type="service" id="serializer.mapping.class_metadata_factory" />
2222
<argument>null</argument> <!-- name converter -->
2323
<argument type="service" id="serializer.property_accessor" />
24+
<argument type="service" id="property_info" on-invalid="ignore" />
2425

2526
<!-- Run after all custom serializers -->
2627
<tag name="serializer.normalizer" priority="-1000" />

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
'enable_annotations' => true,
6969
'name_converter' => 'serializer.name_converter.camel_case_to_snake_case',
7070
),
71+
'property_info' => true,
7172
'ide' => 'file%%link%%format',
7273
'request' => array(
7374
'formats' => array(

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
<framework:validation enabled="true" cache="validator.mapping.cache.doctrine.apc" />
4242
<framework:annotations cache="file" debug="true" file-cache-dir="%kernel.cache_dir%/annotations" />
4343
<framework:serializer enabled="true" enable-annotations="true" name-converter="serializer.name_converter.camel_case_to_snake_case" />
44+
<framework:property-info />
4445
</framework:config>
4546
</container>

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ framework:
5353
enabled: true
5454
enable_annotations: true
5555
name_converter: serializer.name_converter.camel_case_to_snake_case
56+
property_info: ~
5657
ide: file%%link%%format
5758
request:
5859
formats:

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ public function testSerializerEnabled()
462462
$this->assertEquals('Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader', $argument[0]->getClass());
463463
$this->assertNull($container->getDefinition('serializer.mapping.class_metadata_factory')->getArgument(1));
464464
$this->assertEquals(new Reference('serializer.name_converter.camel_case_to_snake_case'), $container->getDefinition('serializer.normalizer.object')->getArgument(1));
465+
$this->assertEquals(new Reference('property_info', ContainerBuilder::IGNORE_ON_INVALID_REFERENCE), $container->getDefinition('serializer.normalizer.object')->getArgument(3));
465466
}
466467

467468
public function testRegisterSerializerExtractor()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.