Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ private function configureRoutes(RoutingConfigurator $routes): void
$routes->import($configDir.'/{routes}/'.$this->environment.'/*.{php,yaml}');
$routes->import($configDir.'/{routes}/*.{php,yaml}');

$routes->import('routing.controllers');

if (is_file($this->getConfigDir().'/routes.yaml')) {
$routes->import($configDir.'/routes.yaml');
} else {
$routes->import($configDir.'/{routes}.php');
}

if ($fileName = (new \ReflectionObject($this))->getFileName()) {
$routes->import($fileName, 'attribute');
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ public static function config(array $config): array
*
* return Routes::config([
* 'controllers' => [
* 'resource' => 'attributes',
* 'type' => 'tagged_services',
* 'resource' => 'routing.controllers',
* ],
* ]);
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public function load(mixed $resource, ?string $type = null): RouteCollection

public function supports(mixed $resource, ?string $type = null): bool
{
return 'tagged_services' === $type && 'attributes' === $resource;
return 'routing.controllers' === $resource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
*
* return Routes::config([
* 'controllers' => [
* 'resource' => 'attributes',
* 'type' => 'tagged_services',
* 'resource' => 'routing.controllers',
* ],
* ]);
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function testSupports()

$this->assertFalse($loader->supports('attributes', null));
$this->assertFalse($loader->supports('attributes', 'attribute'));
$this->assertFalse($loader->supports('other', 'tagged_services'));
$this->assertTrue($loader->supports('attributes', 'tagged_services'));
$this->assertFalse($loader->supports('other', 'routing.controllers'));
$this->assertTrue($loader->supports('routing.controllers'));
}

public function testDelegatesToAttributeLoaderAndMergesCollections()
Expand All @@ -47,7 +47,7 @@ public function testDelegatesToAttributeLoaderAndMergesCollections()
$attributeLoader->setResolver($resolver);
$servicesLoader->setResolver($resolver);

$collection = $servicesLoader->load('attributes', 'tagged_services');
$collection = $servicesLoader->load('routing.controllers');

$this->assertArrayHasKey('action', $collection->all());
$this->assertArrayHasKey('put', $collection->all());
Expand Down
Loading