Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion configuration/front_controllers_and_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ you must implement them all:
:method:`Symfony\\Component\\HttpKernel\\KernelInterface::registerBundles`
It must return an array of all bundles needed to run the application.

:method:`Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait::configureRoutes`
:method:`Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait::configureRouting`
It adds individual routes or collections of routes to the application (for
example loading the routes defined in some config file).

Expand Down
24 changes: 15 additions & 9 deletions configuration/micro_kernel_trait.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Next, create an ``index.php`` file that defines the kernel class and executes it
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

require __DIR__.'/vendor/autoload.php';

Expand All @@ -51,7 +51,7 @@ Next, create an ``index.php`` file that defines the kernel class and executes it
]);
}

protected function configureRoutes(RouteCollectionBuilder $routes)
protected function configureRouting(RoutingConfigurator $routes): void
{
// kernel is a service that points to this class
// optional 3rd argument is the route name
Expand Down Expand Up @@ -98,9 +98,9 @@ that define your bundles, your services and your routes:
of what you see in a normal ``config/packages/*`` file). You can also register
services directly in PHP or load external configuration files (shown below).

**configureRoutes(RouteCollectionBuilder $routes)**
**configureRouting(RoutingConfigurator $routes)**
Your job in this method is to add routes to the application. The
``RouteCollectionBuilder`` has methods that make adding routes in PHP more
``RoutingConfigurator`` has methods that make adding routes in PHP more
fun. You can also load external routing files (shown below).

Advanced Example: Twig, Annotations and the Web Debug Toolbar
Expand Down Expand Up @@ -138,7 +138,7 @@ hold the kernel. Now it looks like this::
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

class Kernel extends BaseKernel
{
Expand Down Expand Up @@ -171,16 +171,22 @@ hold the kernel. Now it looks like this::
}
}

protected function configureRoutes(RouteCollectionBuilder $routes)
protected function configureRouting(RoutingConfigurator $routes): void
{
// import the WebProfilerRoutes, only if the bundle is enabled
if (isset($this->bundles['WebProfilerBundle'])) {
$routes->import('@WebProfilerBundle/Resources/config/routing/wdt.xml', '/_wdt');
$routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml', '/_profiler');
$routes
->import('@WebProfilerBundle/Resources/config/routing/wdt.xml')
->prefix('/_wdt')
;
$routes
->import('@WebProfilerBundle/Resources/config/routing/profiler.xml')
->prefix('/_profiler')
;
}

// load the annotation routes
$routes->import(__DIR__.'/../src/Controller/', '/', 'annotation');
$routes->import(__DIR__.'/../src/Controller/', 'annotation');
}

// optional, to use the standard Symfony cache directory
Expand Down
2 changes: 1 addition & 1 deletion setup/flex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ manual steps:

Make sure that your previous configuration files don't have ``imports``
declarations pointing to resources already loaded by ``Kernel::configureContainer()``
or ``Kernel::configureRoutes()`` methods.
or ``Kernel::configureRouting()`` methods.

#. Move the rest of the ``app/`` contents as follows (and after that, remove the
``app/`` directory):
Expand Down