8000 minor #7915 Fix xml blocks (GuilhemN) · symfony/symfony-docs@a2cf43a · GitHub
[go: up one dir, main page]

Skip to content

Commit a2cf43a

Browse files
committed
minor #7915 Fix xml blocks (GuilhemN)
This PR was merged into the 2.7 branch. Discussion ---------- Fix xml blocks Commits ------- 2bf7529 Fix xml blocks
2 parents aabcf2d + 2bf7529 commit a2cf43a

File tree

83 files changed

+1061
-505
lines changed
  • configuration
  • console
  • controller
  • doctrine
  • email
  • event_dispatcher
  • form
  • introduction
  • logging
  • profiler
  • reference
  • request
  • routing
  • service_container
  • session
  • templating
  • validation
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    83 files changed

    +1061
    -505
    lines changed

    bundles/best_practices.rst

    Lines changed: 11 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -348,9 +348,17 @@ The end user can provide values in any configuration file:
    348348
    .. code-block:: xml
    349349
    350350
    <!-- app/config/config.xml -->
    351-
    <parameters>
    352-
    <parameter key="acme_blog.author.email">fabien@example.com</parameter>
    353-
    </parameters>
    351+
    <?xml version="1.0" encoding="UTF-8" ?>
    352+
    <container xmlns="http://symfony.com/schema/dic/services"
    353+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    354+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    355+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    356+
    357+
    <parameters>
    358+
    <parameter key="acme_blog.author.email">fabien@example.com</parameter>
    359+
    </parameters>
    360+
    361+
    </container>
    354362
    355363
    .. code-block:: php
    356364

    bundles/configuration.rst

    Lines changed: 1 addition & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -225,7 +225,7 @@ thrown)::
    225225
    $configuration = new Configuration();
    226226

    227227
    $config = $this->processConfiguration($configuration, $configs);
    228-
    228+
    229229
    // you now have these 2 config keys
    230230
    // $config['twitter']['client_id'] and $config['twitter']['client_secret']
    231231
    }
    @@ -424,7 +424,6 @@ Assuming the XSD file is called ``hello-1.0.xsd``, the schema location will be
    424424
    425425
    <!-- app/config/config.xml -->
    426426
    <?xml version="1.0" ?>
    427-
    428427
    <container xmlns="http://symfony.com/schema/dic/services"
    429428
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    430429
    xmlns:acme-hello="http://acme_company.com/schema/dic/hello"

    bundles/prepend_extension.rst

    Lines changed: 15 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -12,7 +12,7 @@ users to choose to remove functionality they are not using. Creating multiple
    1212
    bundles has the drawback that configuration becomes more tedious and settings
    1313
    often need to be repeated for various bundles.
    1414

    15-
    It is possible to remove the disadvantage of the multiple bundle approach
    15+
    It is possible to remove the disadvantage of the multiple bundle approach
    1616
    by enabling a single Extension to prepend the settings for any bundle.
    1717
    It can use the settings defined in the ``app/config/config.yml``
    1818
    to prepend settings just as if they had been written explicitly by
    @@ -116,11 +116,21 @@ The above would be the equivalent of writing the following into the
    116116
    .. code-block:: xml
    117117
    118118
    <!-- app/config/config.xml -->
    119-
    <acme-something:config use-acme-goodbye="false">
    120-
    <acme-something:entity-manager-name>non_default</acme-something:entity-manager-name>
    121-
    </acme-something:config>
    119+
    <?xml version="1.0" encoding="UTF-8" ?>
    120+
    <container xmlns="http://symfony.com/schema/dic/services"
    121+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    122+
    xmlns:acme-something="http://example.org/schema/dic/acme_something"
    123+
    xmlns:acme-other="http://example.org/schema/dic/acme_other"
    124+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    125+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    122126
    123-
    <acme-other:config use-acme-goodbye="false" />
    127+
    <acme-something:config use-acme-goodbye="false">
    128+
    <acme-something:entity-manager-name>non_default</acme-something:entity-manager-name>
    129+
    </acme-something:config>
    130+
    131+
    <acme-other:config use-acme-goodbye="false" />
    132+
    133+
    </container>
    124134
    125135
    .. code-block:: php
    126136

    configuration/environments.rst

    Lines changed: 60 additions & 16 deletions
    Original file line numberDiff line numberDiff line change
    @@ -69,11 +69,22 @@ accomplished easily and transparently:
    6969
    7070
    .. code-block:: xml
    7171
    72-
    <imports>
    73-
    <import resource="config.xml" />
    74-
    </imports>
    72+
    <?xml version="1.0" encoding="UTF-8" ?>
    73+
    <container xmlns="http://symfony.com/schema/dic/services"
    74+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    75+
    xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
    76+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    77+
    http://symfony.com/schema/dic/services/services-1.0.xsd
    78+
    http://symfony.com/schema/dic/doctrine
    79+
    http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
    7580
    76-
    <!-- ... -->
    81+
    <imports>
    82+
    <import resource="config.xml" />
    83+
    </imports>
    84+
    85+
    <!-- ... -->
    86+
    87+
    </container>
    7788
    7889
    .. code-block:: php
    7990
    @@ -104,11 +115,22 @@ configuration file:
    104115
    .. code-block:: xml
    105116
    106117
    <!-- app/config/config_dev.xml -->
    107-
    <imports>
    108-
    <import resource="config.xml" />
    109-
    </imports>
    118+
    <?xml version="1.0" encoding="UTF-8" ?>
    119+
    <container xmlns="http://symfony.com/schema/dic/services"
    120+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    121+
    xmlns:webprofiler="http://symfony.com/schema/dic/webprofiler"
    122+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    123+
    http://symfony.com/schema/dic/services/services-1.0.xsd
    124+
    http://symfony.com/schema/dic/webprofiler
    125+
    http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd">
    126+
    127+
    <imports>
    128+
    <import resource="config.xml" />
    129+
    </imports>
    130+
    131+
    <webprofiler:config toolbar="true" />
    110132
    111-
    <webprofiler:config toolbar="true" />
    133+
    </container>
    112134
    113135
    .. code-block:: php
    114136
    @@ -201,7 +223,18 @@ this code and changing the environment string.
    201223
    202224
    .. code-block:: xml
    203225
    204-
    <doctrine:dbal logging="%kernel.debug%" />
    226+
    <?xml version="1.0" encoding="UTF-8" ?>
    227+
    <container xmlns="http://symfony.com/schema/dic/services"
    228+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    229+
    xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
    230+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    231+
    http://symfony.com/schema/dic/services/services-1.0.xsd
    232+
    http://symfony.com/schema/dic/doctrine
    233+
    http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
    234+
    235+
    <doctrine:dbal logging="%kernel.debug%" />
    236+
    237+
    </container>
    205238
    206239
    .. code-block:: php
    207240
    @@ -283,13 +316,24 @@ The best way to accomplish this is via a new environment called, for example,
    283316
    .. code-block:: xml
    284317
    285318
    <!-- app/config/config_benchmark.xml -->
    286-
    <imports>
    287-
    <import resource="config_prod.xml" />
    288-
    </imports>
    289-
    290-
    <framework:config>
    291-
    <framework:profiler only-exceptions="false" />
    292-
    </framework:config>
    319+
    <?xml version="1.0" encoding="UTF-8" ?>
    320+
    <container xmlns="http://symfony.com/schema/dic/services"
    321+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    322+
    xmlns 10000 :framework="http://symfony.com/schema/dic/symfony"
    323+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    324+
    http://symfony.com/schema/dic/services/services-1.0.xsd
    325+
    http://symfony.com/schema/dic/symfony
    326+
    http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
    327+
    328+
    <imports>
    329+
    <import resource="config_prod.xml" />
    330+
    </imports>
    331+
    332+
    <framework:config>
    333+
    <framework:profiler only-exceptions="false" />
    334+
    </framework:config>
    335+
    336+
    </container>
    293337
    294338
    .. code-block:: php
    295339

    configuration/external_parameters.rst

    Lines changed: 31 additions & 14 deletions
    < 10000 tr class="diff-line-row">
    Original file line numberDiff line numberDiff line change
    @@ -103,17 +103,26 @@ You can now reference these parameters wherever you need them.
    103103
    104104
    .. code-block:: xml
    105105
    106-
    <!-- xmlns:doctrine="http://symfony.com/schema/dic/doctrine" -->
    107-
    <!-- xsi:schemaLocation="http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd"> -->
    108-
    109-
    <doctrine:config>
    110-
    <doctrine:dbal
    111-
    driver="pdo_mysql"
    112-
    dbname="symfony_project"
    113-
    user="%database.user%"
    114-
    password="%database.password%"
    115-
    />
    116-
    </doctrine:config>
    106+
    <!-- app/config/config.xml -->
    107+
    <?xml version="1.0" encoding="UTF-8" ?>
    108+
    <container xmlns="http://symfony.com/schema/dic/services"
    109+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    110+
    xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
    111+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    112+
    http://symfony.com/schema/dic/services/services-1.0.xsd
    113+
    http://symfony.com/schema/dic/doctrine
    114+
    http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
    115+
    116+
    <doctrine:config>
    117+
    <doctrine:dbal
    118+
    driver="pdo_mysql"
    119+
    dbname="symfony_project"
    120+
    user="%database.user%"
    121+
    password="%database.password%"
    122+
    />
    123+
    </doctrine:config>
    124+
    125+
    </container>
    117126
    118127
    .. code-block:: php
    119128
    @@ -150,9 +159,17 @@ in the container. The following imports a file named ``parameters.php``.
    150159
    .. code-block:: xml
    151160
    152161
    <!-- app/config/config.xml -->
    153-
    <imports>
    154-
    <import resource="parameters.php" />
    155-
    </imports>
    162+
    <?xml version="1.0" encoding="UTF-8" ?>
    163+
    <container xmlns="http://symfony.com/schema/dic/services"
    164+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    165+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    166+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    167+
    168+
    <imports>
    169+
    <import resource="parameters.php" />
    170+
    </imports>
    171+
    172+
    </container>
    156173
    157174
    .. code-block:: php
    158175

    configuration/override_dir_structure.rst

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -115,6 +115,7 @@ define your own templates directory (or directories):
    115115
    <twig:config>
    116116
    <twig:path>%kernel.root_dir%/../templates</twig:path>
    117117
    </twig:config>
    118+
    118119
    </container>
    119120
    120121
    .. code-block:: php
    @@ -192,6 +193,7 @@ file:
    192193
    193194
    <!-- ... -->
    194195
    <assetic:config read-from="%kernel.root_dir%/../../public_html" />
    196+
    195197
    </container>
    196198
    197199
    .. code-block:: php

    configuration/using_parameters_in_dic.rst

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -56,10 +56,10 @@ Now, examine the results to see this closely:
    5656
    <my-bundle:config logging="true" />
    5757
    <!-- true, as expected -->
    5858
    59-
    <my-bundle:config logging="%kernel.debug%" />
    60-
    <!-- true/false (depends on 2nd parameter of AppKernel),
    61-
    as expected, because %kernel.debug% inside configuration
    62-
    gets evaluated before being passed to the extension -->
    59+
    <my-bundle:config logging="%kernel.debug%" />
    60+
    <!-- true/false (depends on 2nd parameter of AppKernel),
    61+
    as expected, because %kernel.debug% inside configuration
    62+
    gets evaluated before being passed to the extension -->
    6363
    6464
    <my-bundle:config />
    6565
    <!-- passes the string "%kernel.debug%".

    console/commands_as_services.rst

    Lines changed: 5 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -39,14 +39,15 @@ with ``console.command``:
    3939
    <container xmlns="http://symfony.com/schema/dic/services"
    4040
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4141
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    42-
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    42+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    4343
    4444
    <services>
    4545
    <service id="app.command.my_command"
    4646
    class="AppBundle\Command\MyCommand">
    4747
    <tag name="console.command" />
    4848
    </service>
    4949
    </services>
    50+
    5051
    </container>
    5152
    5253
    .. code-block:: php
    @@ -89,7 +90,7 @@ store the default value in some ``%command.default_name%`` parameter::
    8990
    public function __construct($defaultName)
    9091
    {
    9192
    $this->defaultName = $defaultName;
    92-
    93+
    9394
    parent::__construct();
    9495
    }
    9596

    @@ -145,7 +146,7 @@ inject the ``command.default_name`` parameter:
    145146
    <container xmlns="http://symfony.com/schema/dic/services"
    146147
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    147148
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    148-
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    149+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    149150
    150151
    <parameters>
    151152
    <parameter key="command.default_name">Javier</parameter>
    @@ -158,6 +159,7 @@ inject the ``command.default_name`` parameter:
    158159
    <tag name="console.command" />
    159160
    </service>
    160161
    </services>
    162+
    161163
    </container>
    162164
    163165
    .. code-block:: php

    console/logging.rst

    Lines changed: 8 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -95,15 +95,17 @@ First configure a listener for console exception events in the service container
    9595
    <!-- app/config/services.xml -->
    9696
    <?xml version="1.0" encoding="UTF-8" ?>
    9797
    <container xmlns="http://symfony.com/schema/dic/services"
    98-
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    99-
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    98+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    99+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    100+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    100101
    101102
    <services>
    102103
    <service id="app.listener.command_exception" class="AppBundle\EventListener\ConsoleExceptionListener">
    103104
    <argument type="service" id="logger"/>
    104105
    <tag name="kernel.event_listener" event="console.exception" />
    105106
    </service>
    106107
    </services>
    108+
    107109
    </container>
    108110
    109111
    .. code-block:: php
    @@ -189,15 +191,17 @@ First configure a listener for console terminate events in the service container
    189191
    <!-- app/config/services.xml -->
    190192
    <?xml version="1.0" encoding="UTF-8" ?>
    191193
    <container xmlns="http://symfony.com/schema/dic/services"
    192-
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    193-
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    194+
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    195+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    196+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    194197
    195198
    <services>
    196199
    <service id="app.listener.command_error" class="AppBundle\EventListener\ErrorLoggerListener">
    197200
    <argument type="service" id="logger"/>
    198201
    <tag name="kernel.event_listener" event="console.terminate" />
    199202
    </service>
    200203
    </services>
    204+
    201205
    </container>
    202206
    203207
    .. code-block:: php

    console/request_context.rst

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -41,7 +41,6 @@ will override the defaults.
    4141
    4242
    <!-- app/config/parameters.xml -->
    4343
    <?xml version="1.0" encoding="UTF-8"?>
    44-
    4544
    <container xmlns="http://symfony.com/schema/dic/services"
    4645
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    4746
    @@ -50,6 +49,7 @@ will override the defaults.
    5049
    <parameter key="router.request_context.scheme">https</parameter>
    5150
    <parameter key="router.request_context.base_url">my/path</parameter>
    5251
    </parameters>
    52+
    5353
    </container>
    5454
    5555
    .. code-block:: php

    controller/error_pages.rst

    Lines changed: 6 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -251,6 +251,7 @@ configuration option to point to it:
    251251
    <twig:config>
    252252
    <twig:exception-controller>AppBundle:Exception:showException</twig:exception-controller>
    253253
    </twig:config>
    254+
    254255
    </container>
    255256
    256257
    .. code-block:: php
    @@ -299,11 +300,12 @@ In that case, you might want to override one or both of the ``showAction()`` and
    299300
    .. code-block:: xml
    300301
    301302
    <!-- app/config/services.xml -->
    302-
    <?xml version="1.0" encoding="utf-8" ?>
    303+
    <?xml version="1.0" encoding="UTF-8" ?>
    303304
    <container xmlns="http://symfony.com/schema/dic/services"
    304305
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    305-
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
    306-
    >
    306+
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    307+
    http://symfony.com/schema/dic/services/services-1.0.xsd">
    308+
    307309
    <services>
    308310
    <service id="app.exception_controller"
    309311
    class="AppBundle\Controller\CustomExceptionController"
    @@ -312,6 +314,7 @@ In that case, you might want to override one or both of the ``showAction()`` and
    312314
    <argument>%kernel.debug%</argument>
    313315
    </service>
    314316
    </services>
    317+
    315318
    </container>
    316319
    317320
    .. code-block:: php

    0 commit comments

    Comments
     (0)
    0