Skip to content

Fix xml blocks #7915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,17 @@ The end user can provide values in any configuration file:
.. code-block:: xml

<!-- app/config/config.xml -->
<parameters>
<parameter key="acme_blog.author.email">fabien@example.com</parameter>
</parameters>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="acme_blog.author.email">fabien@example.com</parameter>
</parameters>

</container>

.. code-block:: php

Expand Down
3 changes: 1 addition & 2 deletions bundles/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ thrown)::
$configuration = new Configuration();

$config = $this->processConfiguration($configuration, $configs);

// you now have these 2 config keys
// $config['twitter']['client_id'] and $config['twitter']['client_secret']
}
Expand Down Expand Up @@ -424,7 +424,6 @@ Assuming the XSD file is called ``hello-1.0.xsd``, the schema location will be

<!-- app/config/config.xml -->
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:acme-hello="http://acme_company.com/schema/dic/hello"
Expand Down
20 changes: 15 additions & 5 deletions bundles/prepend_extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ users to choose to remove functionality they are not using. Creating multiple
bundles has the drawback that configuration becomes more tedious and settings
often need to be repeated for various bundles.

It is possible to remove the disadvantage of the multiple bundle approach
It is possible to remove the disadvantage of the multiple bundle approach
by enabling a single Extension to prepend the settings for any bundle.
It can use the settings defined in the ``app/config/config.yml``
to prepend settings just as if they had been written explicitly by
Expand Down Expand Up @@ -116,11 +116,21 @@ The above would be the equivalent of writing the following into the
.. code-block:: xml

<!-- app/config/config.xml -->
<acme-something:config use-acme-goodbye="false">
<acme-something:entity-manager-name>non_default</acme-something:entity-manager-name>
</acme-something:config>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:acme-something="http://example.org/schema/dic/acme_something"
xmlns:acme-other="http://example.org/schema/dic/acme_other"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<acme-other:config use-acme-goodbye="false" />
<acme-something:config use-acme-goodbye="false">
<acme-something:entity-manager-name>non_default</acme-something:entity-manager-name>
</acme-something:config>

<acme-other:config use-acme-goodbye="false" />

</container>

.. code-block:: php

Expand Down
76 changes: 60 additions & 16 deletions configuration/environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,22 @@ accomplished easily and transparently:

.. code-block:: xml

<imports>
<import resource="config.xml" />
</imports>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/doctrine
http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">

<!-- ... -->
<imports>
<import resource="config.xml" />
</imports>

<!-- ... -->

</container>

.. code-block:: php

Expand Down Expand Up @@ -104,11 +115,22 @@ configuration file:
.. code-block:: xml

<!-- app/config/config_dev.xml -->
<imports>
<import resource="config.xml" />
</imports>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webprofiler="http://symfony.com/schema/dic/webprofiler"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/webprofiler
http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd">

<imports>
<import resource="config.xml" />
</imports>

<webprofiler:config toolbar="true" />

<webprofiler:config toolbar="true" />
</container>

.. code-block:: php

Expand Down Expand Up @@ -201,7 +223,18 @@ this code and changing the environment string.

.. code-block:: xml

<doctrine:dbal logging="%kernel.debug%" />
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/doctrine
http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">

<doctrine:dbal logging="%kernel.debug%" />

</container>

.. code-block:: php

Expand Down Expand Up @@ -283,13 +316,24 @@ The best way to accomplish this is via a new environment called, for example,
.. code-block:: xml

<!-- app/config/config_benchmark.xml -->
<imports>
<import resource="config_prod.xml" />
</imports>

<framework:config>
<framework:profiler only-exceptions="false" />
</framework:config>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<imports>
<import resource="config_prod.xml" />
</imports>

<framework:config>
<framework:profiler only-exceptions="false" />
</framework:config>

</container>

.. code-block:: php

Expand Down
45 changes: 31 additions & 14 deletions configuration/external_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,26 @@ You can now reference these parameters wherever you need them.

.. code-block:: xml

<!-- xmlns:doctrine="http://symfony.com/schema/dic/doctrine" -->
<!-- xsi:schemaLocation="http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd"> -->

<doctrine:config>
<doctrine:dbal
driver="pdo_mysql"
dbname="symfony_project"
user="%database.user%"
password="%database.password%"
/>
</doctrine:config>
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/doctrine
http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">

<doctrine:config>
<doctrine:dbal
driver="pdo_mysql"
dbname="symfony_project"
user="%database.user%"
password="%database.password%"
/>
</doctrine:config>

</container>

.. code-block:: php

Expand Down Expand Up @@ -150,9 +159,17 @@ in the container. The following imports a file named ``parameters.php``.
.. code-block:: xml

<!-- app/config/config.xml -->
<imports>
<import resource="parameters.php" />
</imports>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<imports>
<import resource="parameters.php" />
</imports>

</container>

.. code-block:: php

Expand Down
2 changes: 2 additions & 0 deletions configuration/override_dir_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ define your own templates directory (or directories):
<twig:config>
<twig:path>%kernel.root_dir%/../templates</twig:path>
</twig:config>

</container>

.. code-block:: php
Expand Down Expand Up @@ -192,6 +193,7 @@ file:

<!-- ... -->
<assetic:config read-from="%kernel.root_dir%/../../public_html" />

</container>

.. code-block:: php
Expand Down
8 changes: 4 additions & 4 deletions configuration/using_parameters_in_dic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ Now, examine the results to see this closely:
<my-bundle:config logging="true" />
<!-- true, as expected -->

<my-bundle:config logging="%kernel.debug%" />
<!-- true/false (depends on 2nd parameter of AppKernel),
as expected, because %kernel.debug% inside configuration
gets evaluated before being passed to the extension -->
<my-bundle:config logging="%kernel.debug%" />
<!-- true/false (depends on 2nd parameter of AppKernel),
as expected, because %kernel.debug% inside configuration
gets evaluated before being passed to the extension -->

<my-bundle:config />
<!-- passes the string "%kernel.debug%".
Expand Down
8 changes: 5 additions & 3 deletions console/commands_as_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ with ``console.command``:
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="app.command.my_command"
class="AppBundle\Command\MyCommand">
<tag name="console.command" />
</service>
</services>

</container>

.. code-block:: php
Expand Down Expand Up @@ -89,7 +90,7 @@ store the default value in some ``%command.default_name%`` parameter::
public function __construct($defaultName)
{
$this->defaultName = $defaultName;

parent::__construct();
}

Expand Down Expand Up @@ -145,7 +146,7 @@ inject the ``command.default_name`` parameter:
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="command.default_name">Javier</parameter>
Expand All @@ -158,6 +159,7 @@ inject the ``command.default_name`` parameter:
<tag name="console.command" />
</service>
</services>

</container>

.. code-block:: php
Expand Down
12 changes: 8 additions & 4 deletions console/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,17 @@ First configure a listener for console exception events in the service container
<!-- app/config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="app.listener.command_exception" class="AppBundle\EventListener\ConsoleExceptionListener">
<argument type="service" id="logger"/>
<tag name="kernel.event_listener" event="console.exception" />
</service>
</services>

</container>

.. code-block:: php
Expand Down Expand Up @@ -189,15 +191,17 @@ First configure a listener for console terminate events in the service container
<!-- app/config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="app.listener.command_error" class="AppBundle\EventListener\ErrorLoggerListener">
<argument type="service" id="logger"/>
<tag name="kernel.event_listener" event="console.terminate" />
</service>
</services>

</container>

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion console/request_context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ will override the defaults.

<!-- app/config/parameters.xml -->
<?xml version="1.0" encoding="UTF-8"?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Expand All @@ -50,6 +49,7 @@ will override the defaults.
<parameter key="router.request_context.scheme">https</parameter>
<parameter key="router.request_context.base_url">my/path</parameter>
</parameters>

</container>

.. code-block:: php
Expand Down
9 changes: 6 additions & 3 deletions controller/error_pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ configuration option to point to it:
<twig:config>
<twig:exception-controller>AppBundle:Exception:showException</twig:exception-controller>
</twig:config>

</container>

.. code-block:: php
Expand Down Expand Up @@ -299,11 +300,12 @@ In that case, you might want to override one or both of the ``showAction()`` and
.. code-block:: xml

<!-- app/config/services.xml -->
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="app.exception_controller"
class="AppBundle\Controller\CustomExceptionController"
Expand All @@ -312,6 +314,7 @@ In that case, you might want to override one or both of the ``showAction()`` and
<argument>%kernel.debug%</argument>
</service>
</services>

</container>

.. code-block:: php
Expand Down
Loading