@@ -8,25 +8,33 @@ services:
88 vcr.logger :
99 class : VCR\VCRBundle\VCR\Logger
1010
11+ vcr.factory :
12+ class : VCR\VCRFactory
13+ factory : [VCR\VCRFactory, getInstance]
14+
1115 vcr.config :
12- class : VCR\Configuration
16+ class : VCR\Configuration
17+ factory : ['@vcr.factory', getOrCreate]
18+ arguments : [VCR\Configuration]
1319 calls :
1420 - [ enableLibraryHooks, [ "%vcr.library_hooks%" ]]
1521 - [ enableRequestMatchers, [ "%vcr.request_matchers%" ] ]
1622 - [ setCassettePath, [ "%vcr.cassette.path%" ] ]
1723 - [ setStorage, [ "%vcr.cassette.type%" ] ]
1824
19- vcr.http_client :
20- class : VCR\Util\HttpClient
25+ # passing '@vcr.config' as third parameter to getOrCreate ensures the VCR\Configuration class is
26+ # created and configured by the symfony di as expected (because the configuration object is already
27+ # created by the factory) #hack
2128
22- vcr.factory :
23- class : VCR\VCRFactory
24- factory : [VCR\VCRFactory, getInstance ]
25- arguments : [ '@vcr.config' ]
29+ vcr.http_client :
30+ class : VCR\Util\HttpClient
31+ factory : ['@vcr.factory', getOrCreate ]
32+ arguments : [VCR\Util\HttpClient, [], '@vcr.config']
2633
2734 vcr.recorder :
2835 class : VCR\Videorecorder
29- arguments : [ '@vcr.config', '@vcr.http_client', '@vcr.factory' ]
36+ factory : ['@vcr.factory', getOrCreate]
37+ arguments : [ VCR\Videorecorder, [], '@vcr.config']
3038 calls :
3139 - [ setEventDispatcher, [ '@event_dispatcher' ] ]
3240 public : true
0 commit comments