bug #9197 [FrameworkBundle] updated XML route description (jfsimon)

This PR was merged into the master branch.

Discussion
----------

[FrameworkBundle] updated XML route description

This PR turns

```xml
<route name="route_1" path="/hello/{name}" class="Symfony\Component\Routing\Route" path_regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">
```

into

```xml
<route name="route_1" class="Symfony\Component\Routing\Route">
    <path regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">/hello/{name}</path>
```

in XML routing description.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7887
| License       | MIT
| Doc PR        | n/a

Commits
-------

7b99ede [FrameworkBundle] updated XML route description
This commit is contained in:
Fabien Potencier 2013-10-02 16:57:54 +02:00
commit 96fb922e67
4 changed files with 12 additions and 6 deletions

View File

@ -128,9 +128,11 @@ class XmlDescriptor extends Descriptor
$routeXML->setAttribute('name', $name);
}
$routeXML->setAttribute('path', $route->getPath());
$routeXML->setAttribute('class', get_class($route));
$routeXML->setAttribute('path_regex', $route->compile()->getRegex());
$routeXML->appendChild($pathXML = $dom->createElement('path'));
$pathXML->setAttribute('regex', $route->compile()->getRegex());
$pathXML->appendChild(new \DOMText($route->getPath()));
if ('' !== $route->getHost()) {
$routeXML->appendChild($hostXML = $dom->createElement('host'));

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<route path="/hello/{name}" class="Symfony\Component\Routing\Route" path_regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">
<route class="Symfony\Component\Routing\Route">
<path regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">/hello/{name}</path>
<host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<route path="/name/add" class="Symfony\Component\Routing\Route" path_regex="#^/name/add$#s">
<route class="Symfony\Component\Routing\Route">
<path regex="#^/name/add$#s">/name/add</path>
<host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes>
<route name="route_1" path="/hello/{name}" class="Symfony\Component\Routing\Route" path_regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">
<route name="route_1" class="Symfony\Component\Routing\Route">
<path regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">/hello/{name}</path>
<host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>
@ -18,7 +19,8 @@
<option key="opt2">val2</option>
</options>
</route>
<route name="route_2" path="/name/add" class="Symfony\Component\Routing\Route" path_regex="#^/name/add$#s">
<route name="route_2" class="Symfony\Component\Routing\Route">
<path regex="#^/name/add$#s">/name/add</path>
<host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>