sulu/sulu-rector

Nessesary steps to update actual NCA client projects from version 2.2 to 2.4

Opened this issue · 6 comments

Sulu Update

Nessesary steps to update actual NCA client projects from version 2.2 to 2.4

Composer file

require

-   "doctrine/dbal": "^2.10",
-   "sulu/sulu": "~2.2.4",
+   "sulu/sulu": "^2.4",

config

+"allow-plugins": {
+    "symfony/flex": true,
+    "symfony/thanks": true
+}

Bundles

+Sulu\Bundle\ActivityBundle\SuluActivityBundle::class => ['all' => true],
+Sulu\Bundle\TrashBundle\SuluTrashBundle::class => ['all' => true],

Config files

config/packages/security_admin.yaml

+    access_control:
+       - { path: ^/admin/p/, roles: IS_AUTHENTICATED_ANONYMOUSLY }

// I could not do this in security yaml because it was empty and could not do format well

config/routes_admin.yaml

+sulu_activity_api:
+    resource: "@SuluActivityBundle/Resources/config/routing_api.yml"
+    type: rest
+    prefix: /admin/api
+
+sulu_trash_api:
+    resource: "@SuluTrashBundle/Resources/config/routing_api.yml"
+    type: rest
+    prefix: /admin/api
+
+sulu_preview_api:
+    type: rest
+    resource: "@SuluPreviewBundle/Resources/config/routing_api.yml"
+    prefix: /admin/api
+
+sulu_preview_public:
+    resource: "@SuluPreviewBundle/Resources/config/routing_public.yml"
+    prefix: /admin/p

Javascript and CSS asset files for admin area

Rebuild

bin/console sulu:admin:update-build

DB migrations

bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate

Update to PHP 8

composer.json require

-"php": "^7.4",
+"php": "^8.1",

Dockerfile

-FROM php:7.4-apache AS webserver
+FROM php:8.1-apache AS webserver

Add docker-compose.override.yml

version: '3'

services:
+###> symfony/mailer ###
+  mailer:
+     image: schickling/mailcatcher
+     ports: [1025, 1080]
+###< symfony/mailer ###

// Do not know if this is needed

Thank for the issue. This helps really to tackle Sulu Rector ugprades and improve it step by step. I writing here some notes what we will handle and what not.

Composer plugins will not be handled by Sulu Rector. It alwas project choice which plugins they want to use. And when upgrading they are already asked by composer. So the allowed-plugins is fine and don't need to be managed by Sulu Rector.

The step in the composer.json which they want to ugprade will also not be handled by Sulu Rector it always the choice of the project to which version they want to update.

PS: We recommend using ~2.4.6 not ^2.4 as we recommend doing minor upgrades of Sulu actively and not accidently.

The docker-compose should be updated by symfony/flex itself so we don't need to handle that one. Also composer.json as above need always done by the project as they need to decide which version the server is using.

So what could be automated would be SuluActivityBundle and SuluTrashBundle registration. I think we could add a rule to rector-symfony package for adding and removing a Bundle.

The yaml routes update would also be awesome. Currently we have here the same issue as in #13. Rector does not support out of the box something else then PHP files And we would need to implement a custom rector processor for yaml files like I think you did find in typo3 rector?

Any idea...i ran in second project in this issue

Unable to generate a URL for the named route "sulu_preview.start" as such route does not exist.

Yes

@rogoit then I think you missed this section in the UGPRADE.md: https://github.com/sulu/sulu/blob/2.5/UPGRADE.md#240 as if you run into any problems check if did check all changes inside the UGPRADE.md file.

Fix it with best practice from here - thx for your passion

https://raw.githubusercontent.com/sulu/sulu-demo/master/config/routes/sulu_admin.yaml