Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: userc865b
Added: Jan 31, 2018 9:56 AM
Modified: Jan 31, 2018 9:57 AM
Views: 24
Tags: symfony
shows the difference between manual injection of a specific paramter and automatic injection of a service in service.yml
  1.  
  2.  # manual injection of a constructor argument the services that have this class in constructor argument must not have this class referenced in this file!
  3. AppBundle\WetterApi\WeatherData:
  4.         arguments: ['Hamburg']
  5.  
  6.  
  7. # automatic injection of constructor argument of other service
  8.     naming:
  9.         class: AppBundle\WetterApi\Criteria\CriteriaNaming
  10.         arguments: ['@citydata']
  11.  
  12. citydata:
  13.         AppBundle\WetterApi\WeatherData:  # manual injection of a constructor argument
  14.         arguments: ['@someotherservice']        
  15.