Skip to content

Commit aa0ed35

Browse files
Revert "feature #30501 [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers (HeahDude)"
This reverts commit 477ee19778db2a30ac04d1dc1b6b32492ccf9f52, reversing changes made to 9bfa25869adab00162c246f4b76d65ca3b78e41a.
1 parent da80471 commit aa0ed35

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Loader/XmlFileLoader.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,33 +104,31 @@ public function supports($resource, string $type = null)
104104
/**
105105
* Parses a route and adds it to the RouteCollection.
106106
*
107-
* @param \DOMElement $node Element to parse that represents a Route
108-
* @param string $filepath Full path of the XML file being processed
107+
* @param \DOMElement $node Element to parse that represents a Route
108+
* @param string $path Full path of the XML file being processed
109109
*
110110
* @throws \InvalidArgumentException When the XML is invalid
111111
*/
112-
protected function parseRoute(RouteCollection $collection, \DOMElement $node, string $filepath)
112+
protected function parseRoute(RouteCollection $collection, \DOMElement $node, string $path)
113113
{
114114
if ('' === $id = $node->getAttribute('id')) {
115-
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" attribute.', $filepath));
115+
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" attribute.', $path));
116116
}
117117

118118
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY);
119119
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY);
120120

121-
list($defaults, $requirements, $options, $condition, $paths, /* $prefixes */, $hosts) = $this->parseConfigs($node, $filepath);
122-
123-
$path = $node->getAttribute('path');
121+
list($defaults, $requirements, $options, $condition, $paths, /* $prefixes */, $hosts) = $this->parseConfigs($node, $path);
124122

125-
if (!$paths && '' === $path) {
126-
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have a "path" attribute or <path> child nodes.', $filepath));
123+
if (!$paths && '' === $node->getAttribute('path')) {
124+
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have a "path" attribute or <path> child nodes.', $path));
127125
}
128126

129-
if ($paths && '' !== $path) {
130-
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "path" attribute and <path> child nodes.', $filepath));
127+
if ($paths && '' !== $node->getAttribute('path')) {
128+
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "path" attribute and <path> child nodes.', $path));
131129
}
132130

133-
$routes = $this->createLocalizedRoute($collection, $id, $paths ?: $path);
131+
$routes = $this->createLocalizedRoute($collection, $id, $paths ?: $node->getAttribute('path'));
134132
$routes->addDefaults($defaults);
135133
$routes->addRequirements($requirements);
136134
$routes->addOptions($options);

0 commit comments

Comments
 (0)