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)
3131 return ;
3232 }
3333
34+ $ definition = $ container ->getDefinition ('property_info ' );
35+
3436 $ listExtractors = $ this ->findAndSortTaggedServices ('property_info.list_extractor ' , $ container );
35- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (0 , $ listExtractors );
37+ $ definition ->replaceArgument (0 , $ listExtractors );
3638
3739 $ typeExtractors = $ this ->findAndSortTaggedServices ('property_info.type_extractor ' , $ container );
38- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (1 , $ typeExtractors );
40+ $ definition ->replaceArgument (1 , $ typeExtractors );
3941
4042 $ descriptionExtractors = $ this ->findAndSortTaggedServices ('property_info.description_extractor ' , $ container );
41- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (2 , $ descriptionExtractors );
43+ $ definition ->replaceArgument (2 , $ descriptionExtractors );
4244
4345 $ accessExtractors = $ this ->findAndSortTaggedServices ('property_info.access_extractor ' , $ container );
44- $ container -> getDefinition ( ' property_info ' ) ->replaceArgument (3 , $ accessExtractors );
46+ $ definition ->replaceArgument (3 , $ accessExtractors );
4547 }
4648
4749 /**
Original file line number Diff line number Diff line change 5555
5656 <!-- Name converter -->
5757 <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 >
5865 </services >
5966</container >
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ public function testServicesAreOrderedAccordingToPriority()
3232
3333 $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerBuilder ' , array ('findTaggedServiceIds ' ));
3434
35- $ container ->expects ($ this ->any ())
35+ $ container
36+ ->expects ($ this ->any ())
3637 ->method ('findTaggedServiceIds ' )
3738 ->will ($ this ->returnValue ($ services ));
3839
@@ -53,9 +54,11 @@ public function testReturningEmptyArrayWhenNoService()
5354 {
5455 $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerBuilder ' , array ('findTaggedServiceIds ' ));
5556
56- $ container ->expects ($ this ->any ())
57+ $ container
58+ ->expects ($ this ->any ())
5759 ->method ('findTaggedServiceIds ' )
58- ->will ($ this ->returnValue (array ()));
60+ ->will ($ this ->returnValue (array ()))
61+ ;
5962
6063 $ propertyInfoPass = new PropertyInfoPass ();
6164
Original file line number Diff line number Diff line change @@ -441,6 +441,18 @@ public function testSerializerEnabled()
441441 $ this ->assertEquals (new Reference ('serializer.name_converter.camel_case_to_snake_case ' ), $ container ->getDefinition ('serializer.normalizer.object ' )->getArgument (1 ));
442442 }
443443
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+
444456 public function testAssetHelperWhenAssetsAreEnabled ()
445457 {
446458 $ container = $ this ->createContainerFromFile ('full ' );
You can’t perform that action at this time.
0 commit comments