Skip to content

Commit 58adaf5

Browse files
[Routing] Simplify importing routes defined on controller services
1 parent 1edda89 commit 58adaf5

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Kernel/MicroKernelTrait.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ private function configureRoutes(RoutingConfigurator $routes): void
7979
$routes->import($configDir.'/{routes}/'.$this->environment.'/*.{php,yaml}');
8080
$routes->import($configDir.'/{routes}/*.{php,yaml}');
8181

82+
$routes->import('routing.controllers');
83+
8284
if (is_file($this->getConfigDir().'/routes.yaml')) {
8385
$routes->import($configDir.'/routes.yaml');
8486
} else {
8587
$routes->import($configDir.'/{routes}.php');
8688
}
87-
88-
if ($fileName = (new \ReflectionObject($this))->getFileName()) {
89-
$routes->import($fileName, 'attribute');
90-
}
9189
}
9290

9391
/**

Tests/Fixtures/reference.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ public static function config(array $config): array
184184
*
185185
* return Routes::config([
186186
* 'controllers' => [
187-
* 'resource' => 'attributes',
188-
* 'type' => 'tagged_services',
187+
* 'resource' => 'routing.controllers',
189188
* ],
190189
* ]);
191190
* ```

0 commit comments

Comments
 (0)