Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Routing] Deprecate RouteCollectionBuilder #32937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

vudaltsov
Copy link
Contributor

@vudaltsov vudaltsov commented Aug 5, 2019

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:

  • finish deprecations in the MicroKernelTrait
  • deprecate the class
  • mention in the CHANGELOG file
  • mention in the UPGRADE file
  • mark tests as legacy
  • add a doc PR
  • update the recipe

Ping @Tobion , @nicolas-grekas .

@nicolas-grekas nicolas-grekas added this to the next milestone Aug 5, 2019
@vudaltsov vudaltsov changed the title [WIP] Deprecate RouteCollectionBuilder [Routing][WIP] Deprecate RouteCollectionBuilder Aug 5, 2019
@vudaltsov
Copy link
Contributor Author

@nicolas-grekas , @Tobion , could you please give me some feedback so that I can move on?

@nicolas-grekas
Copy link
Member

@Tobion would you have time to help move this one forward soonish? Otherwise, I'd suggest to close (and keep the issue open)

@Tobion
Copy link
Contributor

Tobion commented Oct 26, 2019

I won't be able to work on this as other issues have more priority to me like #33065 and #32077

@vudaltsov
Copy link
Contributor Author

@nicolas-grekas , don't close the PR, please. I will have time to make it ready for review soon. At least we'll discuss it at the hack day in Lisbon ;)

@vudaltsov vudaltsov force-pushed the 32240-deprecate-route-collection-builder branch from 570a239 to 16d5a6d Compare November 10, 2019 16:24
@vudaltsov vudaltsov changed the base branch from 4.4 to master November 10, 2019 16:24
@vudaltsov vudaltsov marked this pull request as ready for review November 10, 2019 16:26
@vudaltsov vudaltsov changed the title [Routing][WIP] Deprecate RouteCollectionBuilder [Routing] Deprecate RouteCollectionBuilder Nov 10, 2019
@vudaltsov
Copy link
Contributor Author

@nicolas-grekas , ready for review with tests and deprecations!

I will finish the CHANGELOG and add the docs once you agree with the implementation.

For now I rebased onto master. Do we have any chance to get this in 4.4? Or it's too late?

@vudaltsov
Copy link
Contributor Author

@nicolas-grekas , fully ready for you review

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea! Would be great to do the same for services late on ;)

@vudaltsov
Copy link
Contributor Author

vudaltsov commented Nov 24, 2019

Yes, I already started in the airplane yesterday ;)

@vudaltsov
Copy link
Contributor Author

@fabpot, thanx, corrected!

@fabpot fabpot force-pushed the 32240-deprecate-route-collection-builder branch from badef1d to e641cbd Compare November 25, 2019 12:06
@fabpot
Copy link
Member

fabpot commented Nov 25, 2019

Thank you @vudaltsov.

@fabpot fabpot closed this in 7719fc7 Nov 25, 2019
@fabpot fabpot merged commit e641cbd into symfony:master Nov 25, 2019
@vudaltsov vudaltsov deleted the 32240-deprecate-route-collection-builder branch November 25, 2019 12:07
nicolas-grekas added a commit that referenced this pull request Dec 13, 2019
…in MicroKernelTrait::configureContainer() (nicolas-grekas)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Allow using a ContainerConfigurator in MicroKernelTrait::configureContainer()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

This PR is a continuation of #32937 (it reverts some parts of it that are not needed anymore). It builds on #34872 for now.

This PR allows using the PHP-DSL natively in our `Kernel::configureContainer()` methods.
It allows the same in our `Kernel::configureRoutes()` methods.

Both signatures are handled gracefully with no deprecations to let existing code in peace:
- `protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader);`
- `protected function configureContainer(ContainerConfigurator $c);` (a loader is always passed as 2nd arg to ease FC)

Same for routes:
- `protected function configureRoutes(RoutingConfigurator $routes);`
- `protected function configureRoutes(RouteCollectionBuilder $routes);` (this one is deprecated because `RouteCollectionBuilder` is deprecated)

Here is my working `src/Kernel.php` after this change:

```php
class Kernel extends BaseKernel
{
    use MicroKernelTrait;

    protected function configureContainer(ContainerConfigurator $container): void
    {
        $container->import('../config/{packages}/*.yaml');
        $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
        $container->import('../config/services.yaml');
        $container->import('../config/{services}_'.$this->environment.'.yaml');
    }

    protected function configureRoutes(RoutingConfigurator $routes): void
    {
        $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
        $routes->import('../config/{routes}/*.yaml');
        $routes->import('../config/routes.yaml');
    }
}
```

Commits
-------

cf45eec [FrameworkBundle] Allow using a ContainerConfigurator in MicroKernelTrait::configureContainer()
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
@fabpot fabpot mentioned this pull request May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants