Skip to content

Fixed XML examples #2866

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
Aug 25, 2013
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
28 changes: 21 additions & 7 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,16 @@ to the controller:
.. code-block:: xml

<!-- app/config/routing.xml -->
<route id="hello" path="/hello/{name}">
<default key="_controller">AcmeHelloBundle:Hello:index</default>
</route>
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="hello" path="/hello/{name}">
<default key="_controller">AcmeHelloBundle:Hello:index</default>
</route>
</routes>

.. code-block:: php

Expand Down Expand Up @@ -235,10 +242,17 @@ example:
.. code-block:: xml

<!-- app/config/routing.xml -->
<route id="hello" path="/hello/{first_name}/{last_name}">
<default key="_controller">AcmeHelloBundle:Hello:index</default>
<default key="color">green</default>
</route>
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="hello" path="/hello/{first_name}/{last_name}">
<default key="_controller">AcmeHelloBundle:Hello:index</default>
<default key="color">green</default>
</route>
</routes>

.. code-block:: php

Expand Down
67 changes: 45 additions & 22 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,24 @@ information. By convention, this information is usually configured in an
.. code-block:: xml

<!-- app/config/config.xml -->
<doctrine:config>
<doctrine:dbal
driver="%database_driver%"
host="%database_host%"
dbname="%database_name%"
user="%database_user%"
password="%database_password%"
>
</doctrine: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: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="%database_driver%"
host="%database_host%"
dbname="%database_name%"
user="%database_user%"
password="%database_password%"
>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be />

</doctrine:config>

</container>

.. code-block:: php

Expand Down Expand Up @@ -161,13 +170,22 @@ for you:
.. code-block:: xml

<!-- app/config/config.xml -->
<doctrine:config
driver="pdo_sqlite"
path="%kernel.root_dir%/sqlite.db"
charset="UTF-8"
>
<!-- ... -->
</doctrine: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: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
driver="pdo_sqlite"
path="%kernel.root_dir%/sqlite.db"
charset="UTF-8"
>
<!-- ... -->
</doctrine:config>

</container>

.. code-block:: php

Expand Down Expand Up @@ -299,6 +317,7 @@ in a number of different formats including YAML, XML or directly inside the
.. code-block:: xml

<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
Expand Down Expand Up @@ -833,9 +852,11 @@ To do this, add the name of the repository class to your mapping definition.
.. code-block:: xml

<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->

<!-- ... -->
<doctrine-mapping>
<?xml version="1.0" encoding="UTF-8" ?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<entity name="Acme\StoreBundle\Entity\Product"
repository-class="Acme\StoreBundle\Entity\ProductRepository">
Expand Down Expand Up @@ -1332,9 +1353,11 @@ the current date, only when the entity is first persisted (i.e. inserted):
.. code-block:: xml

<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->

<!-- ... -->
<doctrine-mapping>
<?xml version="1.0" encoding="UTF-8" ?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<entity name="Acme\StoreBundle\Entity\Product">
<!-- ... -->
Expand Down
64 changes: 45 additions & 19 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ object.

<!-- Acme/TaskBundle/Resources/config/validation.xml -->
<?xml version="1.0" charset="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be encoding here ?

<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="Acme\TaskBundle\Entity\Task">
<property name="task">
<constraint name="NotBlank" />
Expand Down Expand Up @@ -912,10 +916,16 @@ easy to use in your application.
.. code-block:: xml

<!-- src/Acme/TaskBundle/Resources/config/services.xml -->
<service id="acme_demo.form.type.task"
class="Acme\TaskBundle\Form\Type\TaskType">
<tag name="form.type" alias="task" />
</service>
<?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>

<service id="acme_demo.form.type.task"
class="Acme\TaskBundle\Form\Type\TaskType">
<tag name="form.type" alias="task" />
</service>
</container>

.. code-block:: php

Expand Down Expand Up @@ -1375,12 +1385,20 @@ file:
.. code-block:: xml

<!-- app/config/config.xml -->
<twig:config ...>
<twig:form>
<resource>AcmeTaskBundle:Form:fields.html.twig</resource>
</twig:form>
<!-- ... -->
</twig: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:twig="http://symfony.com/schema/dic/twig"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">

<twig:config>
<twig:form>
<twig:resource>AcmeTaskBundle:Form:fields.html.twig</twig:resource>
</twig:form>
<!-- ... -->
</twig:config>
</container>

.. code-block:: php

Expand Down Expand Up @@ -1453,14 +1471,22 @@ file:
.. code-block:: xml

<!-- app/config/config.xml -->
<framework:config ...>
<framework:templating>
<framework:form>
<resource>AcmeTaskBundle:Form</resource>
</framework:form>
</framework:templating>
<!-- ... -->
</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">

<framework:config ...>
<framework:templating>
<framework:form>
<framework:resource>AcmeTaskBundle:Form</framework:resource>
</framework:form>
</framework:templating>
<!-- ... -->
</framework:config>
</container>

.. code-block:: php

Expand Down
31 changes: 24 additions & 7 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,19 @@ First, to use ESI, be sure to enable it in your application configuration:
.. code-block:: xml

<!-- app/config/config.xml -->
<framework:config ...>
<!-- ... -->
<framework:esi enabled="true" />
</framework:config>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/symfony"
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">

<framework:config ...>
<!-- ... -->
<framework:esi enabled="true" />
</framework:config>

</container>

.. code-block:: php

Expand Down Expand Up @@ -957,9 +966,17 @@ listener that must be enabled in your configuration:
.. code-block:: xml

<!-- app/config/config.xml -->
<framework:config>
<framework:fragments path="/_fragment" />
</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: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/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:fragments path="/_fragment" />
</framework:config>
</container>

.. code-block:: php

Expand Down
13 changes: 10 additions & 3 deletions book/http_fundamentals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,16 @@ by adding an entry for ``/contact`` to your routing configuration file:

.. code-block:: xml

<route id="contact" path="/contact">
<default key="_controller">AcmeDemoBundle:Main:contact</default>
</route>
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="contact" path="/contact">
<default key="_controller">AcmeDemoBundle:Main:contact</default>
</route>
</routes>

.. code-block:: php

Expand Down
50 changes: 32 additions & 18 deletions book/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -566,20 +566,27 @@ the configuration for the development environment:

.. code-block:: xml

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

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

<!-- enable the web profiler -->
<webprofiler:config
toolbar="true"
intercept-redirects="true"
verbose="true"
/>
<?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"
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/webprofiler http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

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

<!-- enable the web profiler -->
<webprofiler:config
toolbar="true"
intercept-redirects="true"
verbose="true"
/>
</container>

.. code-block:: php

Expand Down Expand Up @@ -614,10 +621,17 @@ If you enable the web profiler, you also need to mount the profiler routes:

.. code-block:: xml

<import
resource="@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix="/_profiler"
/>
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">

<import
resource="@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix="/_profiler"
/>
</routes>

.. code-block:: php

Expand Down
Loading