[FrameworkBundle] updated XML route description

This commit is contained in:
Jean-François Simon 2013-10-01 18:21:39 +02:00
parent 04d767db56
commit 7b99ede0dc
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('name', $name);
} }
$routeXML->setAttribute('path', $route->getPath());
$routeXML->setAttribute('class', get_class($route)); $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()) { if ('' !== $route->getHost()) {
$routeXML->appendChild($hostXML = $dom->createElement('host')); $routeXML->appendChild($hostXML = $dom->createElement('host'));

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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> <host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme> <scheme>http</scheme>
<scheme>https</scheme> <scheme>https</scheme>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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> <host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme> <scheme>http</scheme>
<scheme>https</scheme> <scheme>https</scheme>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<routes> <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> <host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme> <scheme>http</scheme>
<scheme>https</scheme> <scheme>https</scheme>
@ -18,7 +19,8 @@
<option key="opt2">val2</option> <option key="opt2">val2</option>
</options> </options>
</route> </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> <host regex="#^localhost$#s">localhost</host>
<scheme>http</scheme> <scheme>http</scheme>
<scheme>https</scheme> <scheme>https</scheme>