Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #32937 [Routing] Deprecate RouteCollectionBuilder (vudaltsov)
This PR was squashed before being merged into the 5.1-dev branch (closes #32937). Discussion ---------- [Routing] Deprecate RouteCollectionBuilder | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #32240 | License | MIT | Doc PR | symfony/symfony-docs#12688 | Recipe PR | symfony/recipes#690 A lot to be done here after the implementation is accepted: - [x] finish deprecations in the MicroKernelTrait - [x] deprecate the class - [x] mention in the CHANGELOG file - [x] mention in the UPGRADE file - [x] mark tests as legacy - [x] add a doc PR - [x] update the recipe Ping @Tobion , @nicolas-grekas . Commits ------- e641cbd [Routing] Deprecate RouteCollectionBuilder
- Loading branch information
Showing
12 changed files
with
200 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
UPGRADE FROM 5.0 to 5.1 | ||
======================= | ||
|
||
FrameworkBundle | ||
--------------- | ||
|
||
* Marked `MicroKernelTrait::configureRoutes()` as `@internal` and `@final`. | ||
* Deprecated not overriding `MicroKernelTrait::configureRouting()`. | ||
|
||
Routing | ||
------- | ||
|
||
* Deprecated `RouteCollectionBuilder` in favor of `RoutingConfigurator`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
UPGRADE FROM 5.x to 6.0 | ||
======================= | ||
|
||
FrameworkBundle | ||
--------------- | ||
|
||
* Removed `MicroKernelTrait::configureRoutes()`. | ||
* Made `MicroKernelTrait::configureRouting()` abstract. | ||
|
||
Routing | ||
------- | ||
|
||
* Removed `RouteCollectionBuilder`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelWithConfigureRoutes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\FrameworkBundle\Tests\Kernel; | ||
|
||
use Psr\Log\NullLogger; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Routing\RouteCollectionBuilder; | ||
|
||
class MicroKernelWithConfigureRoutes extends Kernel | ||
{ | ||
use MicroKernelTrait; | ||
|
||
private $cacheDir; | ||
|
||
public function registerBundles(): iterable | ||
{ | ||
return [ | ||
new FrameworkBundle(), | ||
]; | ||
} | ||
|
||
public function getCacheDir(): string | ||
{ | ||
return $this->cacheDir = sys_get_temp_dir().'/sf_micro_kernel_with_configured_routes'; | ||
} | ||
|
||
public function getLogDir(): string | ||
{ | ||
return $this->cacheDir; | ||
} | ||
|
||
public function __sleep(): array | ||
{ | ||
throw new \BadMethodCallException('Cannot serialize '.__CLASS__); | ||
} | ||
|
||
public function __wakeup() | ||
{ | ||
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); | ||
} | ||
|
||
public function __destruct() | ||
{ | ||
$fs = new Filesystem(); | ||
$fs->remove($this->cacheDir); | ||
} | ||
|
||
protected function configureRoutes(RouteCollectionBuilder $routes) | ||
{ | ||
$routes->add('/', 'kernel::halloweenAction'); | ||
} | ||
|
||
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) | ||
{ | ||
$c->register('logger', NullLogger::class); | ||
$c->loadFromExtension('framework', [ | ||
'secret' => '$ecret', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters