sonata-project / dev-kit

Development kit of the Sonata-Project
https://master-7rqtwti-ptm4dx6rjpjko.eu-5.platformsh.site/
42 stars 42 forks source link

[RFC] Modernising sandbox #391

Closed Xymanek closed 4 years ago

Xymanek commented 6 years ago

When I first learned about Sonata project (basically admin bundle) the demo site was a great help in learning about what abilities SonataAdmin has. Unfortunately the code behind it is.. horribly outdated. PHP 5.3 and Symfony 2.5. Since I think it's a great exploration resource for new developers (since docs are quite overwhelming at that point) I think it would be a great idea to modernize it.

A good target would be flex structure with symfony 3.4. This way we don't have to deal with problems arising from fact that not all bundles are updated to support 4.0 and after the initial migration is finished upgrading to 4 won't be that hard.

One thing needs to be discussed: how to deal with fact that flex promotes bundle-less structure? Do we try to "collapse" the bundles?

What are your thoughts?

Xymanek commented 6 years ago

I can help with transferring to flex structure and updating forms to use class names instead of aliases but that's about it since I didn't work with any bundles other than admin

jordisala1991 commented 6 years ago

Maybe it could be a good idea to first go with 3.4 without flex and then move to flex? Just to not do too many things at once. The code on sandbox is really broken due to dependencies resolution and probably it will break when upgrading to SF 3.4 too

kunicmarko20 commented 6 years ago

If we do this, I would go with php 7.1 to make easier to continue maintaining it later. I can try and help with this also.

greg0ire commented 6 years ago

Or even 7.2 ;)

Xymanek commented 6 years ago

@jordisala1991 wouldn't that just split the migration into more stages?

@kunicmarko20 @greg0ire agreed, there is zero reason to support older versions since it's a demonstration project, no a reusable library

Also for 4.0 - didn't symfony remove bundle inheritance?

jordisala1991 commented 6 years ago

Yes, it will split the migrations into more stages. I was just thinking on doing it in small steps that could give value instead of doing a big migration. But it can be done all at once

Xymanek commented 6 years ago

Or did you mean like

  1. Make it run on 3.4 (eg. fix the dependency mess)
  2. Update structure

That would make sense

jordisala1991 commented 6 years ago

Yes, that's what I had in mind

Xymanek commented 6 years ago

I started doing some preliminary work on this and set two simple objectives:

  1. Bump version requirements to latest stable on everything (and get composer update to work)
  2. Get php app\console to run without problems

While doing (1) I also cleaned up composer.json a bit by removing redundant entries (eg. sonata-project/comment-bundle already requires friendsofsymfony/comment-bundle, no point doing it again). In the end I got composer to successfully resolve (without crashing due to exceeding 1.5 GB memory limit....) and install everything. Here are my notes:

After that I started working on (2). I had to fix the autoloader, got rid of bootstrap file, added sonata-project/google-authenticator package (by request of SonataUserExtension.php line 159), fixed a couple of config files. Then, however, I hit a roadblock (... means path to where the sandbox folder is located):

In XmlFileLoader.php line 386:

  Unable to parse file "...\sandbox\vendor\sonata-project\ecommerce\src\BasketBundle\DependencyInjection/../Resources/config\basket.xml".

In XmlUtils.php line 101:

  [ERROR 1866] Element '{http://symfony.com/schema/dic/services}service', attribute 'factory-service': The attribute 'factory-service' is not allowed. (in file:/.../sandbox/ - line 24, column 0)
  [ERROR 1866] Element '{http://symfony.com/schema/dic/services}service', attribute 'factory-method': The attribute 'factory-method' is not allowed. (in file:/.../sandbox/ - line 24, column 0)

The whole effort can be found here: https://github.com/Xymanek/sandbox/commit/6eec21de98514f5252612652807107219284dd02

P.S. Yes, I'm using windows

greg0ire commented 6 years ago

I think factory-service is an old, pre 2.8 of defining factories, to be checked.

Xymanek commented 6 years ago

What's the status of sonata-project/ecommerce? The latest stable doesn't even support sf 3...

jordisala1991 commented 6 years ago

Stable won't support SF 3, because it was added on master for the next major version

Xymanek commented 6 years ago

Ah ok, when is the next major planned?

jordisala1991 commented 6 years ago

It is not planned yet

Xymanek commented 6 years ago

Ok, so should we target 3.x-dev for sandbox, or should the ecommerce functionality be removed until it gets the next major release?

jordisala1991 commented 6 years ago

Probably using 3.x-dev is a better idea

Xymanek commented 6 years ago

Yeah, it will also help developing the ecommerce as well

Xymanek commented 6 years ago

(as my recent run-ins with bugs uncovered 😂)

Xymanek commented 6 years ago

I've got the console to run albeit by removing some things. You can see my efforts here: https://github.com/Xymanek/sandbox/tree/3.4

A question: are JMS AOP/Security bundles needed? I couldn't find them used anywhere... Also they aren't really maintained anymore (eg. security last release Oct 30, 2016) so maybe it makes sense to drop them?

To get sandbox to run I had to comment out some things - can somebody take a look? Also, what should the next steps be? Any suggestions?

greg0ire commented 6 years ago

A question: are JMS AOP/Security bundles needed? I couldn't find them used anywhere... Also they aren't really maintained anymore (eg. security last release Oct 30, 2016) so maybe it makes sense to drop them?

Yeah that should probably be removed.

To get sandbox to run I had to comment out some things - can somebody take a look? Also, what should the next steps be? Any suggestions?

Next steps would be to uncomment what you commented I guess? Or remove it completely?

jordisala1991 commented 6 years ago

Next steps would be to uncomment what you commented I guess? Or remove it completely?

Not for the missing features of sonataUserBundle, please let that commented for the moment instead.

Xymanek commented 6 years ago

Current state of sandbox.

I've got both php app/console and http version to run. The HTTP version however doesn't really work as the PageBundle isn't able to match any site since fixtures are broken. Someone with knowledge (I only used Admin, Block and Core before) will need to look into them.

Attempting to loading a page currently produces 152 deprecations, here is a full list: https://prnt.sc/ifnw1r. The majority of them are:

Also there are deprecations about extending from deprecated classes and using depreciated PHP function. The majority of them I can fix but someone will need to look into deprecated services:

- Using service id sonata.news.block.breadcrumb_archive different from block id news_archive is deprecated since 3.3 and will be removed in 4.
- Using service id sonata.news.block.breadcrumb_post different from block id news_post is deprecated since 3.3 and will be removed in 4.0.
- Using service id sonata.media.block.breadcrumb_view different from block id gallery_view is deprecated since 3.3 and will be removed in 4.0.
- Using service id sonata.media.block.breadcrumb_index different from block id gallery_index is deprecated since 3.3 and will be removed in 4.0.
- Using service id sonata.media.block.breadcrumb_view_media different from block id media_view is deprecated since 3.3 and will be removed in 4.0.
- Using service id sonata.product.block.breadcrumb different from block id catalog is deprecated since 3.3 and will be removed in 4.0.
- Using service id sonata.product.block.filters_menu different from block id sonata.product.block.product_menu is deprecated since 3.3 and will be removed in 4.0.
- Using service id sonata.seo.block.breadcrumb.homepage different from block id homepage is deprecated since 3.3 and will be removed in 4.0.

Also I just realized that I nuked some hand-written scripts (along with auto-generated composer ones). I'm planning to rewrite them as Phing tasks (or whatever they are called)

Xymanek commented 6 years ago

https://github.com/sonata-project/sandbox/issues/607

Xymanek commented 6 years ago

Bump

Can someone (with knowledge of sonata bundles) take a look at fixtures? Currently almost all of them crash...

kunicmarko20 commented 6 years ago

How can I test fixtures? Or what is the error you are getting?

Xymanek commented 6 years ago

How can I test fixtures?

You can pull my fork I guess...

what is the error you are getting?

Check the latest commit in PR, I commented all errors there

wbloszyk commented 4 years ago

@Xymanek Thanks for prepare sandbox 3.0. I develop it and I done. Now I slit it and push atomics PR to easy marge. Feel free to help with check it.

More info: https://github.com/sonata-project/sandbox/pull/616

jordisala1991 commented 4 years ago

This can be closed