services9.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <container xmlns="http://www.symfony-project.org/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
  3. <parameters>
  4. <parameter key="baz_class">BazClass</parameter>
  5. <parameter key="foo_class">FooClass</parameter>
  6. <parameter key="foo">bar</parameter>
  7. </parameters>
  8. <services>
  9. <service id="foo" class="FooClass" factory-method="getInstance" scope="prototype">
  10. <tag name="foo" foo="foo"/>
  11. <tag name="foo" bar="bar"/>
  12. <argument>foo</argument>
  13. <argument type="service" id="foo.baz"/>
  14. <argument type="collection">
  15. <argument key="%foo%">foo is %foo%</argument>
  16. <argument key="bar">%foo%</argument>
  17. </argument>
  18. <argument>true</argument>
  19. <argument type="service" id="service_container"/>
  20. <call method="setBar">
  21. <argument type="service" id="bar"/>
  22. </call>
  23. <call method="initialize"/>
  24. <configurator function="sc_configure"/>
  25. </service>
  26. <service id="bar" class="FooClass">
  27. <argument>foo</argument>
  28. <argument type="service" id="foo.baz"/>
  29. <argument>%foo_bar%</argument>
  30. <configurator service="foo.baz" method="configure"/>
  31. </service>
  32. <service id="foo.baz" class="%baz_class%" factory-method="getInstance">
  33. <configurator class="%baz_class%" method="configureStatic1"/>
  34. </service>
  35. <service id="foo_bar" class="%foo_class%"/>
  36. <service id="method_call1" class="FooClass">
  37. <file>%path%foo.php</file>
  38. <call method="setBar">
  39. <argument type="service" id="foo"/>
  40. </call>
  41. <call method="setBar">
  42. <argument type="service" id="foo2" on-invalid="null"/>
  43. </call>
  44. <call method="setBar">
  45. <argument type="service" id="foo3" on-invalid="ignore"/>
  46. </call>
  47. <call method="setBar">
  48. <argument type="service" id="foobaz" on-invalid="ignore"/>
  49. </call>
  50. </service>
  51. <service id="factory_service" factory-method="getInstance" factory-service="foo.baz"/>
  52. <service id="alias_for_foo" alias="foo"/>
  53. </services>
  54. </container>