From 8e8df56022a6d740e2fdd59e32e73c8b7a0416f0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 17 Dec 2018 17:15:34 +0100 Subject: [PATCH] Doc CompiledUrlMatcherDumper instead of PhpMatcherDumper --- create_framework/routing.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/create_framework/routing.rst b/create_framework/routing.rst index 75e4c2598a1..d49dbcac066 100644 --- a/create_framework/routing.rst +++ b/create_framework/routing.rst @@ -217,6 +217,12 @@ generate absolute URLs:: highly optimized URL matcher class that can replace the default ``UrlMatcher``:: - $dumper = new Routing\Matcher\Dumper\PhpMatcherDumper($routes); + use Symfony\Component\Routing\Matcher\CompiledUrlMatcher; + use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper; - echo $dumper->dump(); + // $compiledRoutes is a plain PHP array that describes + // all routes using a performant data format + // you can and SHOULD cache it, typically by exporting it to a PHP file + $compiledRoutes = (new CompiledUrlMatcherDumper($routes))->getCompiledRoutes(); + + $matcher = new CompiledUrlMatcher($compiledRoutes, $context);