File tree Expand file tree Collapse file tree 4 files changed +31
-7
lines changed
src/Symfony/Bundle/FrameworkBundle
DependencyInjection/Compiler
Tests/DependencyInjection Expand file tree Collapse file tree 4 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -31,17 +31,19 @@ public function process(ContainerBuilder $container)
31
31
return ;
32
32
}
33
33
34
+ $ definition = $ container ->getDefinition ('property_info ' );
35
+
34
36
$ listExtractors = $ this ->findAndSortTaggedServices ('property_info.list_extractor ' , $ container );
35
- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (0 , $ listExtractors );
37
+ $ definition ->replaceArgument (0 , $ listExtractors );
36
38
37
39
$ typeExtractors = $ this ->findAndSortTaggedServices ('property_info.type_extractor ' , $ container );
38
- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (1 , $ typeExtractors );
40
+ $ definition ->replaceArgument (1 , $ typeExtractors );
39
41
40
42
$ descriptionExtractors = $ this ->findAndSortTaggedServices ('property_info.description_extractor ' , $ container );
41
- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (2 , $ descriptionExtractors );
43
+ $ definition ->replaceArgument (2 , $ descriptionExtractors );
42
44
43
45
$ accessExtractors = $ this ->findAndSortTaggedServices ('property_info.access_extractor ' , $ container );
44
- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (3 , $ accessExtractors );
46
+ $ definition ->replaceArgument (3 , $ accessExtractors );
45
47
}
46
48
47
49
/**
Original file line number Diff line number Diff line change 55
55
56
56
<!-- Name converter -->
57
57
<service id =" serializer.name_converter.camel_case_to_snake_case" class =" Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter" public =" false" />
58
+
59
+ <!-- PropertyInfo extractor -->
60
+ <service id =" property_info.serializer_extractor" class =" Symfony\Component\PropertyInfo\Extractor\SerializerExtractor" public =" false" >
61
+ <argument type =" service" id =" serializer.mapping.class_metadata_factory" />
62
+
63
+ <tag name =" property_info.list_extractor" priority =" -999" />
64
+ </service >
58
65
</services >
59
66
</container >
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ public function testServicesAreOrderedAccordingToPriority()
32
32
33
33
$ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerBuilder ' , array ('findTaggedServiceIds ' ));
34
34
35
- $ container ->expects ($ this ->any ())
35
+ $ container
36
+ ->expects ($ this ->any ())
36
37
->method ('findTaggedServiceIds ' )
37
38
->will ($ this ->returnValue ($ services ));
38
39
@@ -53,9 +54,11 @@ public function testReturningEmptyArrayWhenNoService()
53
54
{
54
55
$ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerBuilder ' , array ('findTaggedServiceIds ' ));
55
56
56
- $ container ->expects ($ this ->any ())
57
+ $ container
58
+ ->expects ($ this ->any ())
57
59
->method ('findTaggedServiceIds ' )
58
- ->will ($ this ->returnValue (array ()));
60
+ ->will ($ this ->returnValue (array ()))
61
+ ;
59
62
60
63
$ propertyInfoPass = new PropertyInfoPass ();
61
64
Original file line number Diff line number Diff line change @@ -441,6 +441,18 @@ public function testSerializerEnabled()
441
441
$ this ->assertEquals (new Reference ('serializer.name_converter.camel_case_to_snake_case ' ), $ container ->getDefinition ('serializer.normalizer.object ' )->getArgument (1 ));
442
442
}
443
443
444
+ public function testRegisterSerializerExtractor ()
445
+ {
446
+ $ container = $ this ->createContainerFromFile ('full ' );
447
+
448
+ $ serializerExtractorDefinition = $ container ->getDefinition ('property_info.serializer_extractor ' );
449
+
450
+ $ this ->assertEquals ('serializer.mapping.class_metadata_factory ' , $ serializerExtractorDefinition ->getArgument (0 )->__toString ());
451
+ $ this ->assertFalse ($ serializerExtractorDefinition ->isPublic ());
452
+ $ tag = $ serializerExtractorDefinition ->getTag ('property_info.list_extractor ' );
453
+ $ this ->assertEquals (array ('priority ' => -999 ), $ tag [0 ]);
454
+ }
455
+
444
456
public function testAssetHelperWhenAssetsAreEnabled ()
445
457
{
446
458
$ container = $ this ->createContainerFromFile ('full ' );
You can’t perform that action at this time.
0 commit comments