Skip to content

Commit 4935e9a

Browse files
change copy_as configured to options child node.
1 parent f1754c6 commit 4935e9a

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/Routing/Loader/YamlFileLoader.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class YamlFileLoader extends \Symfony\Component\Routing\Loader\YamlFileLoader
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)
27+
public function import($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null, $exclude = null)
2828
{
2929
$routeCollection = parent::import($resource, $type, $ignoreErrors, $sourceResource);
3030
$copyAs = $this->copyAs[count($this->copyAs) - 1];
@@ -43,26 +43,9 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function load($file, $type = null)
46+
protected function parseImport(RouteCollection $collection, array $config, string $path, string $file)
4747
{
48-
$availableKeysProperty = new \ReflectionProperty(\Symfony\Component\Routing\Loader\YamlFileLoader::class, 'availableKeys');
49-
$availableKeysProperty->setAccessible(true);
50-
$availableKeys = $availableKeysProperty->getValue();
51-
if (!in_array('copy_as', $availableKeys)) {
52-
$availableKeys[] = 'copy_as';
53-
$availableKeysProperty->setValue(null, $availableKeys);
54-
}
55-
$availableKeysProperty->setAccessible(false);
56-
57-
return parent::load($file, $type);
58-
}
59-
60-
/**
61-
* {@inheritdoc}
62-
*/
63-
protected function parseImport(RouteCollection $collection, array $config, $path, $file)
64-
{
65-
$this->copyAs[] = isset($config['copy_as']) ? $config['copy_as'] : null;
48+
$this->copyAs[] = isset($config['options']['copy_as']) ? $config['options']['copy_as'] : null;
6649

6750
parent::parseImport($collection, $config, $path, $file);
6851
}

0 commit comments

Comments
 (0)