Skip to content
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

Symfony 5 compatibility #5788

Closed
mouad-mahfoud opened this issue Dec 11, 2019 · 83 comments
Closed

Symfony 5 compatibility #5788

mouad-mahfoud opened this issue Dec 11, 2019 · 83 comments

Comments

@mouad-mahfoud
Copy link

I am trying to install sonata admin bundle in a fresh Symfony 5 installation but I get this error :
Problem 1
- Conclusion: don't install sonata-project/admin-bundle 3.56.1
- Conclusion: remove twig/twig v3.0.0
- Installation request for sonata-project/admin-bundle ^3.56 -> satisfiable by sonata-project/admin-bundle[3.56.0, 3.56.1].
- Conclusion: don't install twig/twig v3.0.0
- sonata-project/admin-bundle 3.56.0 requires twig/twig ^2.10 -> satisfiable by twig/twig[v2.10.0, v2.11.0, v2.11.1, v2.11.2, v2.11.3, v2.12.0, v2.12.1, v2.12.2].
- Can only install one of: twig/twig[v2.10.0, v3.0.0].
- Can only install one of: twig/twig[v2.11.0, v3.0.0].
- Can only install one of: twig/twig[v2.11.1, v3.0.0].
- Can only install one of: twig/twig[v2.11.2, v3.0.0].
- Can only install one of: twig/twig[v2.11.3, v3.0.0].
- Can only install one of: twig/twig[v2.12.0, v3.0.0].
- Can only install one of: twig/twig[v2.12.1, v3.0.0].
- Can only install one of: twig/twig[v2.12.2, v3.0.0].
- Installation request for twig/twig (locked at v3.0.0) -> satisfiable by twig/twig[v3.0.0].

@mouad-mahfoud mouad-mahfoud changed the title installation problem with SonataAdminBundle in symfony 5 installation problem in symfony 5 Dec 11, 2019
@core23
Copy link
Member

core23 commented Dec 11, 2019

Feel free to help us supporting symfony 5 @mouad-mahfoud

@michaelKaefer
Copy link

michaelKaefer commented Dec 19, 2019

@core23 How can we help? Would it be correct to clone the latest version, then upgrade all symfony packages via composer to 5.*, then run the tests and fix all errors? Is that enough? I want to do this in the holidays.

@core23
Copy link
Member

core23 commented Dec 19, 2019

Would it be correct to clone the latest version, then upgrade all symfony packages via composer to 5.*, then run the tests and fix all errors?

That's the way you go.

But keep in mind, that we have version lock because of required (dev-)dependencies: #5797 (comment). There are also more third party dependencies that may need an update to work with symfony 5

I want to do this in the holidays.

💯 !

@michaelKaefer
Copy link

I think this is too much for me, sorry, somebody else has to do it..

@Bodarev
Copy link

Bodarev commented Dec 23, 2019

#5786 (comment)

help please

@core23
Copy link
Member

core23 commented Dec 23, 2019

Feel free to help with this by contributing @Bodarev

@MrPoliteGrizlyM
Copy link

Have same problem, but with assets:

Problem 1
    - sonata-project/admin-bundle 3.56.1 requires symfony/asset ^3.4.30 || ^4.2 -> no matching package found.
    - sonata-project/admin-bundle 3.56.0 requires symfony/asset ^3.4.30 || ^4.2 -> no matching package found.
    - Installation request for sonata-project/admin-bundle ^3.56 -> satisfiable by sonata-project/admin-bundle[3.56.0, 3.56.1]. 

@VincentLanglet
Copy link
Member

I am trying to install sonata admin bundle in a fresh Symfony 5 installation but I get this error :
Problem 1

  • Conclusion: don't install sonata-project/admin-bundle 3.56.1
  • Conclusion: remove twig/twig v3.0.0
  • Installation request for sonata-project/admin-bundle ^3.56 -> satisfiable by sonata-project/admin-bundle[3.56.0, 3.56.1].
  • Conclusion: don't install twig/twig v3.0.0
  • sonata-project/admin-bundle 3.56.0 requires twig/twig ^2.10 -> satisfiable by twig/twig[v2.10.0, v2.11.0, v2.11.1, v2.11.2, v2.11.3, v2.12.0, v2.12.1, v2.12.2].
  • Can only install one of: twig/twig[v2.10.0, v3.0.0].
  • Can only install one of: twig/twig[v2.11.0, v3.0.0].
  • Can only install one of: twig/twig[v2.11.1, v3.0.0].
  • Can only install one of: twig/twig[v2.11.2, v3.0.0].
  • Can only install one of: twig/twig[v2.11.3, v3.0.0].
  • Can only install one of: twig/twig[v2.12.0, v3.0.0].
  • Can only install one of: twig/twig[v2.12.1, v3.0.0].
  • Can only install one of: twig/twig[v2.12.2, v3.0.0].
  • Installation request for twig/twig (locked at v3.0.0) -> satisfiable by twig/twig[v3.0.0].

This is not an issue with Symfony 5 but only Twig 3.
I think two different issues should be created. One for Sf5 and one for Twig 3.

@greg0ire
Copy link
Contributor

Yeah plus, starting with just Twig 3 might be easier.

@jorrit
Copy link
Contributor

jorrit commented Jan 30, 2020

It is clear that Sonata Admin doesn't work with Symfony 5. Until support is added, perhaps a warning could be added to the installation instructions? I can submit a PR for this, but first I'd like to know if this sounds like a good idea.

@core23
Copy link
Member

core23 commented Jan 30, 2020

It is clear that Sonata Admin doesn't work with Symfony 5. Until support is added, perhaps a warning could be added to the installation instructions? I can submit a PR for this, but first I'd like to know if this sounds like a good idea.

If I got you right: You want a warning, that we don't support symfony 5? You have composer for that

@jorrit
Copy link
Contributor

jorrit commented Jan 30, 2020

What I mean is that it could be helpful to list somewhere in the docs, let's say at https://sonata-project.org/bundles/admin/3-x/doc/getting_started/installation.html, which Symfony version(s) are supported.

Composer does give warnings when installing on Symfony 5, but the warnings given refer to symfony/asset not being the right version, it does not clearly say what the root problem is: Sonata Admin is compatible with Symfony up to 4, not 5.

Perhaps the message currently given by composer is sufficient for most users, but a small addition to the manual would not hurt, I think.

@core23
Copy link
Member

core23 commented Jan 30, 2020

IMHO it's overhead to update two places for every dependency. If we start to list supported symfony versions, we must also list supported versions of php, doctrine, twig, phpunit, ...

@VincentLanglet
Copy link
Member

IMHO it's overhead to update two places for every depedency. If we start to list supported symfony versions, we must also list supported versions of php, doctrine, twig, phpunit, ...

I agree

In the initial issue, composer return the following message.

sonata-project/admin-bundle 3.56.0 requires twig/twig ^2.10

This seems pretty clear.

@greg0ire
Copy link
Contributor

If anyone wants to help, here is where to start:

composer why-not twig/twig 3   
jms/translation-bundle       1.4.4   requires  twig/twig (^1.27 || ^2.0)  
sonata-project/block-bundle  3.18.3  requires  twig/twig (^1.34 || ^2.0)  
sonata-project/core-bundle   3.18.0  requires  twig/twig (^1.34 || ^2.0)  
sonata-project/intl-bundle   2.7.0   requires  twig/twig (^2.9)           
twig/extensions              v1.5.4  requires  twig/twig (^1.27|^2.0)

@jaikdean
Copy link
Contributor

As an update to @greg0ire's last comment…

@VincentLanglet
Copy link
Member

VincentLanglet commented Feb 20, 2020

And you created the issue #5909

@goetas
Copy link
Contributor

goetas commented Feb 21, 2020

schmittjoh/JMSTranslationBundle#519
schmittjoh/JMSTranslationBundle#520

Both PR have been merged

@greg0ire greg0ire pinned this issue Feb 27, 2020
@greg0ire
Copy link
Contributor

@goetas here is one more : schmittjoh/JMSTranslationBundle#522 :)

@VincentLanglet
Copy link
Member

VincentLanglet commented Mar 5, 2020

  • sonata-project/block-bundle 4.0.0 added support for Symfony 5 and Twig 3

The AdminBundle will need to drop support of 3.x blockbundle to be Symfony is 5 compatible or we'll need to fix some deprecation on the 3.x version.

For example:

The "Sonata\BlockBundle\Event\BlockEvent" class extends "Symfony\Component\EventDispatcher\Event" that is deprecated since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead.
    1x in CRUDControllerTest::testList from Sonata\AdminBundle\Tests\Functional\Controller

Does updating the major version of a dependency is a BC-break @greg0ire ?

@jaikdean
Copy link
Contributor

jaikdean commented Mar 5, 2020

The AdminBundle will need to drop support of 3.x blockbundle to be Symfony is 5 compatible or we'll need to fix some deprecation on the 3.x version.

AdminBundle will need to add support for 4.x of BlockBundle. It wouldn't necessarily need to drop support for 3.x.

@VincentLanglet
Copy link
Member

Oh yeah indeed.
It will use both Symfony 5 and BlockBundle 4 or both Symfony 4 and BlockBundle 3.

@jorrit
Copy link
Contributor

jorrit commented Jun 12, 2020

Just to clarify: is it a goal to have Symfony 5 support in Sonata 3? Or is it a goal for Sonata 4?

@VincentLanglet
Copy link
Member

@wbloszyk Will be the best to answer this 😅

@wbloszyk
Copy link
Member

@wbloszyk
Copy link
Member

wbloszyk commented Jun 12, 2020

@jorrit
In SonataBlockBundle add support for:

  • knplabs/knp-menu-bundle ^3.0
  • symfony/* ^4.3 || ^5.0

In SonataIntlBundle add support for:

  • knplabs/knp-menu-bundle ^3.0
  • symfony/* ^4.3 || ^5.0

In SonataAdminBundle add support for:

  • knplabs/knp-menu-bundle ^3.0
  • doctrine/common ^3.0
  • symfony/* ^4.3 || ^5.0

This change will be probably enought to add this support in this bundles.

@jorrit
Copy link
Contributor

jorrit commented Jun 16, 2020

@wbloszyk : Do you mean version 3 of those three modules? Because SonataBlockBundle already has SF5 support but only in version 4.

@wbloszyk
Copy link
Member

Sonata 3 using BlockBundle 3. Add support in Sonata 3 for BlockBundle will be awsome too but much harder.

@jorrit
Copy link
Contributor

jorrit commented Jun 16, 2020

So if I understand it correctly, BlockBundle 3 also has to support Symfony 5?

@wbloszyk
Copy link
Member

All require dependencies have to support symfony 5 too.

@jorrit
Copy link
Contributor

jorrit commented Jun 18, 2020

On #5948 (comment) it was determined that SF 5 compatibility in Sonata 3 is not possible.

@neimheadh
Copy link

neimheadh commented Jun 22, 2020

Hello everyone.

I just forked the project to work on the Symfony 5 compatibility. I don't know a lot about the Sonata admin bundle background, but for the moment I just changed symfony dependencies to "^5.1", and the composer install worked. Of course I have some inheritance errors, I'm working on it, but it seems that the "sonata-project/admin-bundle" sub-dependencies has no problem with SF 5.1.

As I see with the @jorrit comment, you seem to have blocking problems with knp-menus but.. The issue is closed so maybe not. Idk...

Do you have a clear view of SF5-compatibility progress on your side?

@jorrit
Copy link
Contributor

jorrit commented Jun 22, 2020

@neimheadh : The issue was closed for the master branch which will one day be Sonata Admin v4 but I am trying to get a statement on whether SF5 support will ever be available for Sonata Admin v3.

@VincentLanglet
Copy link
Member

On #5948 (comment) it was determined that SF 5 compatibility in Sonata 3 is not possible.

Only if you can avoid this BC-break.

We try to finish the v4, but it's not easy.

@neimheadh
Copy link

@neimheadh : The issue was closed for the master branch which will one day be Sonata Admin v4 but I am trying to get a statement on whether SF5 support will ever be available for Sonata Admin v3.

Yeah I see. Indeed I'm working on master branch. Are you interested I push my change on master when I'll be able to use Sonata (dev-master version) on my project?

@VincentLanglet
Copy link
Member

We are really interested by any kind of PR to help us to finish the v4 or to add the Symfony 5 (or twig 3) support.

The current dev-master branch can't be used. And that's a big issue, because we can't test manually any PR on the master branch.

The first step would be to fix this and allow to use both the SonataAdmin and SonataDoctrineORMAdmin dev-master branch together.
I think it's on the @wbloszyk plans, isn't it ?

@neimheadh
Copy link

Yes, I also try to make SonataDoctrineORMAdmin dev-master work on SF.5.1. Btw I see that @SonataAdmin/standard_layout.html.twig needs @SonataCore/FlashMessage/render.html.twig and @SonataTwig/FlashMessage/render.html.twig.

Is it a reason for sonata-project/admin-bundle not having sonata-project/core-bundle & sonata-project/twig-extensions dependencies?

@VincentLanglet
Copy link
Member

Yes, I also try to make SonataDoctrineORMAdmin dev-master work on SF.5.1. Btw I see that @SonataAdmin/standard_layout.html.twig needs @SonataCore/FlashMessage/render.html.twig and @SonataTwig/FlashMessage/render.html.twig.

Is it a reason for sonata-project/admin-bundle not having sonata-project/core-bundle & sonata-project/twig-extensions dependencies?

It does have twig-extension dependency.
A recent PR removed the Core dependency, I think, by the syntax, it requires @SonataCore/FlashMessage/render.html.twig OR @SonataTwig/FlashMessage/render.html.twig.

@wbloszyk
Copy link
Member

Yes, I'm working on it.
@SonataAdmin/standard_layout.html.twig needs
@SonataCore/FlashMessage/render.html.twig OR @SonataTwig/FlashMessage/render.html.twig.

Now I'm working on replace CoreBundle by form- and twig- extensions 0.x. Then upgrade it to extensions 1.x.
sonata-project/dev-kit#697

To finish it i need improve FlashManager:
sonata-project/twig-extensions#89
sonata-project/twig-extensions#90

At the end support the same BlockBundle version is require to allow use Sonata 3 and Sonata 4 together.

@neimheadh
Copy link

Yep my mistake, it is @SonataCore/FlashMessage/render.html.twig OR @SonataTwig/FlashMessage/render.html.twig.

So if I got it well @wbloszyk, the CoreBundle will be deprecated in the future in favor of SonataTwig (and some others)?

@wbloszyk
Copy link
Member

@neimheadh
Copy link

I finally have a working instance on SF5.1. Here what I had to do :

master...neimheadh:master

  • Changed all sonata-project/admin-bundle symfony dependencies from ^4.3 to ^5.1
  • Changed sonata-project/admin-bundle twig dependency from ^2.12.1 to ^3.0
  • Changed sonata-project/admin-bundle sonata-project/twig-extensions dependency from ^0.1.1 || ^1.3 to 1.x-dev
  • Fix sonata-project/admin-bundle inheritance.

sonata-project/SonataDoctrineORMAdminBundle@master...neimheadh:master

  • Changed all sonata-project/doctrine-orm-admin-bundle symfony dependencies from ^4.3 to ^5.1

  • Added ^3.0 to sonata-project/doctrine-orm-admin-bundle twig dependency

  • Changed sonata-project/doctrine-orm-admin-bundle sonata-project/admin-bundle dependency to dev-master

  • Required sonata-project/twig-extensions:1.x-dev on my project

  • Required sonata-project/doctrine-extensions:1.x-dev on my project

And I'm good, with an empty Sonata project. I don't want to do the PR now as my dependencies changes are a little bit extreme, with no test for the moment of inheritance changes on SF4 and SF5.0. And I also don't know what are your workflow so... Feel free to tell me how to make my PR on your project if you're interested.

@neimheadh
Copy link

neimheadh commented Jun 28, 2020

Hello, it's me again.
Again a little change on AdminBundle fixing exception when I create a new admin on SF5.1 - just changed Symfony\Component\Translation\TranslatorInterface dependency to Symfony\Contracts\Translation\TranslatorInterface. Also fixed dependencies for CRUDController and FieldDescription:
master...neimheadh:master

I also allowed null Help one base fields, I don't know if it should be mandatory, but if I follow documentation, it shouldn't be.

@wbloszyk
Copy link
Member

wbloszyk commented Sep 2, 2020

Close this issue in favor for #6365

@wbloszyk wbloszyk closed this as completed Sep 2, 2020
@wbloszyk wbloszyk unpinned this issue Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet