Guest User

Untitled

a guest
Nov 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. class Foo
  2. {
  3. private $config;
  4.  
  5. /**
  6. * @param Config $config
  7. */
  8. public function __construct(Config $config) {
  9. $this->config = $config->getData();
  10. }
  11. }
  12.  
  13. config:
  14. ...
  15.  
  16. foo:
  17. class: KopernikusLeBundleServiceFoo
  18. arguments:
  19. - @config
  20.  
  21. foo:
  22. class: KopernikusLeBundleServiceFoo
  23. arguments:
  24. - [@config, getData]
  25.  
  26. config:
  27. ...
  28.  
  29. foo:
  30. class: KopernikusLeBundleServiceFoo
  31. arguments: ["@=service('config').getData()"]
  32.  
  33. <?php
  34. class FooContainer implements YourContainerInterface {
  35. public static function get() {
  36. // Config logic here
  37. return new Foo($config);
  38. }
  39. }
Add Comment
Please, Sign In to add comment