8000 tweaks · symfony/symfony@5d068a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d068a4

Browse files
committed
tweaks
1 parent 790ced2 commit 5d068a4

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/framework-routing-1.0.xsd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</xsd:choice>
3030
</xsd:group>
3131

32-
<xsd:complexType name="base-route">
32+
<xsd:complexType name="base-route" abstract="true">
3333
<xsd:attribute name="id" type="xsd:string" use="required" />
3434
<xsd:attribute name="path" type="xsd:string" />
3535
<xsd:attribute name="host" type="xsd:string" />
@@ -46,7 +46,7 @@
4646
<xsd:element name="context" type="map" minOccurs="0" maxOccurs="1" />
4747
<xsd:group ref="base-configs" minOccurs="0" maxOccurs="unbounded" />
4848
</xsd:sequence>
49-
<xsd:attribute name="template" type="xsd:string" />
49+
<xsd:attribute name="template" type="xsd:string" use="required" />
5050
<xsd:attribute name="max-age" type="xsd:int" />
5151
<xsd:attribute name="shared-max-age" type="xsd:int" />
5252
<xsd:attribute name="private" type="xsd:boolean" />
@@ -61,7 +61,7 @@
6161
<xsd:sequence>
6262
<xsd:group ref="base-configs" minOccurs="0" maxOccurs="unbounded" />
6363
</xsd:sequence>
64-
<xsd:attribute name="redirect-to-route" type="xsd:string" />
64+
<xsd:attribute name="redirect-to-route" type="xsd:string" use="required"/>
6565
<xsd:attribute name="permanent" type="xsd:boolean" />
6666
<xsd:attribute name="ignore-attributes" type="xsd:string" />
6767
<xsd:attribute name="keep-request-method" type="xsd:boolean" />
@@ -77,7 +77,7 @@
7777
<xsd:sequence>
7878
<xsd:group ref="base-configs" minOccurs="0" maxOccurs="unbounded" />
7979
</xsd:sequence>
80-
<xsd:attribute name="redirect-to-url" type="xsd:string" />
80+
<xsd:attribute name="redirect-to-url" type="xsd:string" use="required" />
8181
<xsd:attribute name="permanent" type="xsd:boolean" />
8282
<xsd:attribute name="scheme" type="xsd:string" />
8383
<xsd:attribute name="http-port" type="xsd:int" />

src/Symfony/Bundle/FrameworkBundle/Routing/Loader/XmlFileLoader.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Config\Util\Exception\XmlParsingException;
1818
use Symfony\Component\Config\Util\XmlUtils;
1919
use Symfony\Component\Routing\Loader\XmlFileLoader as BaseXmlFileLoader;
20+
use Symfony\Component\Routing\Route;
2021
use Symfony\Component\Routing\RouteCollection;
2122

2223
/**
@@ -118,8 +119,21 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
118119

119120
parent::parseRoute($collection, $node, $path);
120121

121-
$route = $collection->get($node->getAttribute(('id')));
122+
if ($route = $collection->get($id = $node->getAttribute(('id')))) {
123+
$this->parseConfig($node, $route, $templateContext);
122124

125+
return;
126+
}
127+
128+
foreach ($node->getElementsByTagNameNS(self::NAMESPACE_URI, 'path') as $n) {
129+
$route = $collection->get($id.'.'.$n->getAttribute('locale'));
130+
131+
$this->parseConfig($node, $route, $templateContext);
132+
}
133+
}
134+
135+
private function parseConfig(\DOMElement $node, Route $route, array $templateContext): void
136+
{
123137
switch ($node->localName) {
124138
case 'template-route':
125139
$route

0 commit comments

Comments
 (0)
0