kiterstefan
kiterstefan

Reputation: 57

Upgrading from Symfony 1.4 to Symfony 4

We have a Symfony 1.4 application and want to upgrade to Symfony 4. Is it possible or do we have to reprogram the application?

We asked a software company near us and they told us that we have to reprogram the application.

Upvotes: 3

Views: 2276

Answers (6)

David
David

Reputation: 67

For anyone still interested in this task, migrating a Symfony 1.x app to a modern Symfony 4.x and up (including Symfony 5.x), we faced exactly this same task with our company and I found this GitHub project that details how to do it using the Strangler Fig design pattern and the Legacy Route Loader approach that Symfony suggests on their website:

https://github.com/dkusmierek/symfony_migration_example

I can vouch that this DOES work, although there are some tweaks here and there you will need to make to make it work for your specific environment. But it should be enough to get you 90% of the way there.

Upvotes: 0

Tomas Votruba
Tomas Votruba

Reputation: 24280

Disclaimer: I wrote and maintain an open-source tool that handles automated instant migrations called Rector.

Since 2018 these migrations are much easier with help of abstract syntax tree (AST). This technology allows to change one pattern in unlimited amount of files at speed of readfile/printfile.

E.g. 1000 controller from Symfony 1 to Symfony 5 will takes similar amount of time as 1 controller. All you need to do is write migration rules. Some of them are ready in Rector, e.g. Symfony 2.8 via Symfony 5 - see Rector sets on Github.


You can learn more about migration of old Symfony Applications

Upvotes: 0

dbrumann
dbrumann

Reputation: 17166

Symfony 1 is a completely different codebase using different concepts both inside the framework (or application) and with some libraries. For example it uses Propel (Active Record-approach) rather than Doctrine (Data Mapper-approach) for mapping php-objects to a database. The difference between Symfony 2 to 4 is considerably smaller, because they share the same underlying codebase and are therefore closer to each other. Upgrading can still be a lot of work because of deprecations (changed and removed parts of the code), but overall the upgrade process can be done inside the same application. Besides that, you can choose the newest version available and I would argue, if you are starting now/soon, even Symfony 5 beta would be a good candidate.

Basically, if you want to upgrade Symfony 1 you will do a migration to a new system and it will not make much difference if you move to for example Zend Framework 3/Laminas vs. Symfony 4. At least you can directly "upgrade" from Symfony 1 to 4, instead of gradually upgrading from over versions 2/3. It will require a whole lot of manual work, though. Essentially you are migrating between different applications. The Symfony docs have some general advice on how to start a migration project like this: https://symfony.com/doc/current/migration

Basically the approach would be to wrap a new application around the old one (a concept commonly called strangler application) and then move functionality to the new application, e.g. route for route, and falling back to the old application when the new functionality does not yet exist. The main reason for choosing an older version of Symfony, say 3.4, would be restrictions on for example the shared PHP version being used. There are other ways around it, but that would mean substantially more work.

Upvotes: 3

Yassine CHABLI
Yassine CHABLI

Reputation: 3724

Upgrading from 1.4 to 4 is a miracle .

Even if you can upgrade to the version 2 and then 3 untill here it's could be nice , but the version 4 is totally different , so i can advice you to rewrite your code directly instead of wasting time updgrading from version to the upper one.

Upvotes: 0

Jan Myszkier
Jan Myszkier

Reputation: 2744

Symfony Framework developer here:

Symfony does provide upgrade steps between versions. e.g: https://github.com/symfony/symfony/blob/2.1/UPGRADE-2.1.md

But upgrading from 1.4 to 4 is BIG and will require tons of work. I agree: writing the whole app from scratch will be faster from my experience. Upgrading can take years for stable outcome (depending on your application size of course)

Upvotes: 2

Gregoire Ducharme
Gregoire Ducharme

Reputation: 1108

Have a look here: https://symfony.com/doc/current/setup/upgrade_major.html

The difference between Symfony 1 and 4 might be to important, therefore you might consider starting a new project and take some of your previous code for a nicer and cleaner project.

Upvotes: 0

Related Questions