Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9ab27f0

Browse filesBrowse files
committed
Add xml files
1 parent 2636bea commit 9ab27f0
Copy full SHA for 9ab27f0

File tree

1 file changed

+106
-7
lines changed
Filter options

1 file changed

+106
-7
lines changed

‎service_container.rst

Copy file name to clipboardExpand all lines: service_container.rst
+106-7Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,20 @@ the service container *how* to instantiate it:
135135
.. code-block:: xml
136136
137137
<!-- app/config/services.xml -->
138-
TODO
138+
<?xml version="1.0" encoding="UTF-8" ?>
139+
<container xmlns="http://symfony.com/schema/dic/services"
140+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
141+
xsi:schemaLocation="http://symfony.com/schema/dic/services
142+
http://symfony.com/schema/dic/services/services-1.0.xsd">
143+
144+
<services>
145+
<!-- Default configuration for services in *this* file -->
146+
<defaults autowire="true" autoconfigure="true" />
147+
148+
<!-- Load services from whatever directories you want (you can update this!) -->
149+
<prototype namespace="AppBundle\" resource="../../src/AppBundle/{Service,EventDispatcher,Twig,Form}" />
150+
</services>
151+
</container>
139152
140153
.. code-block:: php
141154
@@ -284,7 +297,19 @@ the new ``Updates`` sub-directory:
284297
.. code-block:: xml
285298
286299
<!-- app/config/services.xml -->
287-
TODO
300+
<?xml version="1.0" encoding="UTF-8" ?>
301+
<container xmlns="http://symfony.com/schema/dic/services"
302+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
303+
xsi:schemaLocation="http://symfony.com/schema/dic/services
304+
http://symfony.com/schema/dic/services/services-1.0.xsd">
305+
306+
<services>
307+
<!-- ... -->
308+
309+
<!-- Registers all classes in Services & Updates directories -->
310+
<prototype namespace="AppBundle\" resource="../../src/AppBundle/{Service,Updates,EventDispatcher,Twig,Form}" />
311+
</services>
312+
</container>
288313
289314
.. code-block:: php
290315
@@ -375,7 +400,24 @@ pass here. No problem! In your configuration, you can explicitly set this argume
375400
.. code-block:: xml
376401
377402
<!-- app/config/services.xml -->
378-
TODO
403+
<?xml version="1.0" encoding="UTF-8" ?>
404+
<container xmlns="http://symfony.com/schema/dic/services"
405+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
406+
xsi:schemaLocation="http://symfony.com/schema/dic/services
407+
http://symfony.com/schema/dic/services/services-1.0.xsd">
408+
409+
<services>
410+
<!-- ... -->
411+
412+
<!-- Same as before -->
413+
<prototype namespace="AppBundle\" resource="../../src/AppBundle/{Service,Updates}" />
414+
415+
<!-- Explicitly configure the service -->
416+
<service id="AppBundle\Updates\SiteUpdateManager">
417+
<argument key="$adminEmail">%admin_email%</argument>
418+
</service>
419+
</services>
420+
</container>
379421
380422
.. code-block:: php
381423
@@ -412,7 +454,25 @@ and reference it with the ``%parameter_name%`` syntax:
412454
413455
.. code-block:: xml
414456
415-
TODO
457+
<!-- app/config/services.xml -->
458+
<?xml version="1.0" encoding="UTF-8" ?>
459+
<container xmlns="http://symfony.com/schema/dic/services"
460+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
461+
xsi:schemaLocation="http://symfony.com/schema/dic/services
462+
http://symfony.com/schema/dic/services/services-1.0.xsd">
463+
464+
<parameters>
465+
<parameter key="admin_email">manager@example.com</parameter>
466+
</parameters>
467+
468+
<services>
469+
<!-- ... -->
470+
471+
<service id="AppBundle\Updates\SiteUpdateManager">
472+
<argument key="$adminEmail">%admin_email%</argument>
473+
</service>
474+
</services>
475+
</container>
416476
417477
.. code-block:: php
418478
@@ -495,7 +555,21 @@ But, you can control this and pass in a different logger:
495555
.. code-block:: xml
496556
497557
<!-- app/config/services.xml -->
498-
TODO
558+
<?xml version="1.0" encoding="UTF-8" ?>
559+
<container xmlns="http://symfony.com/schema/dic/services"
560+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
561+
xsi:schemaLocation="http://symfony.com/schema/dic/services
562+
http://symfony.com/schema/dic/services/services-1.0.xsd">
563+
564+
<services>
565+
<!-- ... same code as before -->
566+
567+
<!-- Explicitly configure the service -->
568+
<service id="AppBundle\Service\MessageGenerator">
569+
<argument key="$logger" type="service" id="monolog.logger.request" />
570+
</service>
571+
</services>
572+
</container>
499573
500574
.. code-block:: php
501575
@@ -538,7 +612,20 @@ as a service, and :doc:`tag </service_container/tags>` it with ``twig.extension`
538612
.. code-block:: xml
539613
540614
<!-- app/config/services.xml -->
541-
TODO
615+
<?xml version="1.0" encoding="UTF-8" ?>
616+
<container xmlns="http://symfony.com/schema/dic/services"
617+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
618+
xsi:schemaLocation="http://symfony.com/schema/dic/services
619+
http://symfony.com/schema/dic/services/services-1.0.xsd">
620+
621+
<services>
622+
<!-- ... -->
623+
624+
<service id="AppBundle\Twig\MyTwigExtension">
625+
<tag name="twig.extension" />
626+
</service>
627+
</services>
628+
</container>
542629
543630
.. code-block:: php
544631
@@ -565,7 +652,19 @@ is this:
565652
.. code-block:: xml
566653
567654
<!-- app/config/services.xml -->
568-
TODO
655+
<?xml version="1.0" encoding="UTF-8" ?>
656+
<container xmlns="http://symfony.com/schema/dic/services"
657+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
658+
xsi:schemaLocation="http://symfony.com/schema/dic/services
659+
http://symfony.com/schema/dic/services/services-1.0.xsd">
660+
661+
<services>
662+
<defaults autowire="true" autoconfigure="true" />
663+
664+
<!-- Load your services-->
665+
<prototype namespace="AppBundle\" resource="../../src/AppBundle/{Service,EventDispatcher,Twig,Form}" />
666+
</services>
667+
</container>
569668
570669
.. code-block:: php
571670

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.