Sonataadminbundle: Symfony 5 - TODO list

Created on 2 Sep 2020  路  11Comments  路  Source: sonata-project/SonataAdminBundle

This is TODO list require to add support for Symfony 5.

__Target branch:__ master (Sonata 4)
__Reason__: To much huge BC-break in Sonata 3 (list below).

Add support for Symfony 5.1 bundles (bundles related to Symfony version):

  • [x] [symfony/asset](https://github.com/sonata-project/SonataAdminBundle/pull/6363)
  • [x] [symfony/config](https://github.com/sonata-project/SonataAdminBundle/pull/6369)
  • [x] [symfony/console](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/dependency-injection](https://github.com/sonata-project/SonataAdminBundle/pull/6369)
  • [x] [symfony/doctrine-bridge](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/event-dispatcher](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/form](https://github.com/sonata-project/SonataAdminBundle/pull/6362)
  • [x] [symfony/framework-bundle](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/http-kernel](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/routing](https://github.com/sonata-project/SonataAdminBundle/pull/6369)
  • [x] [symfony/security-bundle](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/security-core](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/security-csrf](https://github.com/sonata-project/SonataAdminBundle/pull/6363)
  • [x] [symfony/translation](https://github.com/sonata-project/SonataAdminBundle/pull/6373)
  • [x] [symfony/twig-bridge](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [symfony/twig-bundle](https://github.com/sonata-project/SonataAdminBundle/pull/6476)

Changes in self code:

  • [x] [remove using Symfony\Bundle\FrameworkBundle\Controller\Controller](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] [remove using Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait](https://github.com/sonata-project/SonataAdminBundle/pull/6476)
  • [x] add return type hint Symfony\Component\OptionsResolver\OptionsResolver::getExtendedTypes(): iterable;
  • [x] [remove using Symfony\Component\Translation\TranslatorInterface](https://github.com/sonata-project/SonataAdminBundle/pull/6476)

Library:

feature

Most helpful comment

I think this can be closed tol

All 11 comments

Problem with TranslatorInterface we can resolve based on idea from comment:
https://github.com/sonata-project/SonataAdminBundle/pull/6342#discussion_r481826857

namespace Symfony\Component\Translation;

if (!interface_exists('Symfony\Component\Translation\TranslatorInterface')) {
    /**
     * @deprecated since sonata-project/admin-bundle 3.x, to be removed in 4.0. Use \Symfony\Contracts\Translation\TranslatorInterface instead.
     */
    class_alias('Symfony\Contracts\Translation\TranslatorInterface', 'Symfony\Component\Translation\TranslatorInterface');
}

This alias will redirect ower setTranslator(ComponentTranslatorInterface $translator) to setTranslator(ContractsTranslatorInterface $translator) when user upgrade Symfony to 5. This will be BC.

@sonata-project/contributors @dmaicher @jaikdean

  • WDYT? Can we add it in Sonata3?

If I miss any problem, feel free to add notes about it.

Problem with TranslatorInterface we can resolve based on idea from comment:
#6342 (comment)

namespace Symfony\Component\Translation;

if (!interface_exists('Symfony\Component\Translation\TranslatorInterface')) {
    /**
     * @deprecated since sonata-project/admin-bundle 3.x, to be removed in 4.0. Use \Symfony\Contracts\Translation\TranslatorInterface instead.
     */
    class_alias('Symfony\Contracts\Translation\TranslatorInterface', 'Symfony\Component\Translation\TranslatorInterface');
}

This alias will redirect ower setTranslator(ComponentTranslatorInterface $translator) to setTranslator(ContractsTranslatorInterface $translator) when user upgrade Symfony to 5. This will be BC.

Imho we should not do this. We don't own that interface so we should not alias it. This can cause all kind of weird issues with other bundles/libraries that do things based on the existence of the legacy interface etc.

@sonata-project/contributors @dmaicher @jaikdean

  • WDYT? Can we add it in Sonata3?

If it was easy, and didn't require BC-break, it would be ok. But it's not.
As explained in another discussion, I think we should focus on 4.0 to release it this year with the Symfony 5 support.

@VincentLanglet I create project based on admin and symfony 5. In issue description I add next problem to resolve which can not be done without huge BC-break on Sonata 3. I will add this issue to https://github.com/sonata-project/SonataAdminBundle/milestone/7

Update
My bad, we can do it in Sonata 4 as minor release :smile:

@greg0ire @wbloszyk @VincentLanglet so was there a decision if we want to support Symfony 5.1 on 3.x or not? I'm slightly confused by all the comments on different issues and PRs :yum:

Also seeing that we keep adding support for symfony 5.1 components on 3.x like in https://github.com/sonata-project/SonataAdminBundle/pull/6363

Out of interest: For how long would 3.x still be maintained (features, bug fixes) after 4.0 was released?

@greg0ire @wbloszyk @VincentLanglet so was there a decision if we want to support Symfony 5.1 on 3.x or not? I'm slightly confused by all the comments on different issues and PRs 馃構

It will certainly be on 4.0 rather than 3.x to avoid multiple BC-break.
If you want to help us, we take it !

Also seeing that we keep adding support for symfony 5.1 components on 3.x like in #6363

This was an easy change, with no BC-break and adding no complexity to the code.

Out of interest: For how long would 3.x still be maintained (features, bug fixes) after 4.0 was released?

Feature won't be added to 3.x as soon as we release 4.0 (except if does help our/the developer migration)
Bug could be backport to 3.x during some time, since the 4.0 introduce big changes. But keep in mind generally don't support multiple versions at the same time.

Out of interest: For how long would 3.x still be maintained (features, bug fixes) after 4.0 was released?

Feature won't be added to 3.x as soon as we release 4.0 (except if does help our/the developer migration)
Bug could be backport to 3.x during some time, since the 4.0 introduce big changes. But keep in mind generally don't support multiple versions at the same time.

I think we can support 3.x with some feature until we don't release whole Sonata4. Anyway we don't wanna do it for all PRs.

Well, I'm not sure if it's easy or not, But I'd like to help, I'll try to get this one symfony/console, But if you have some other suggestion to start could be good, because I'll see how it works :)

Well, I'm not sure if it's easy or not, But I'd like to help, I'll try to get this one symfony/console, But if you have some other suggestion to start could be good, because I'll see how it works :)

Hi @eerison
I think that everything will be solved by this PR: https://github.com/sonata-project/SonataAdminBundle/pull/6476
If you can help on it, it's perfect.

Otherwise you can help with some other Sonata4 PR like this issue https://github.com/sonata-project/SonataAdminBundle/issues/6404 ; since the symfony 5 compatibility will be only released with Sonata 4.

I think this can be closed tol

Was this page helpful?
0 / 5 - 0 ratings