Search code examples
symfonymigrationentitysymfony6

How to migrate Entities from Symfony 2.3 to latest Symfony 6.3 version


We are planning to migrate our Symfony application from old Symfony 2.3 version to latest Symfony 6.3 version.

But I am totally new to MVC framework and this is my first project with Symfony. So, How we can migrate all entities from older version to newer version?

So, for syntax perspective, there are some differences like old Symfony used annotations and new Symfony uses annotations using PHP 8 attributes that one only I understand.

Need proper steps to migrate old Symfony entities to new Symfony.


Solution

  • Migrating major version of SF does not only concern entities, but concern the hole project files and structure and the most your composer.json file and config directory. In simple case you must as described Upgrading a Major Version (e.g. 5.4.0 to 6.0.0):

    • Check/correct your deprecated classes
    • update your composer.json
    • check/correct the rest of your project files

    But in your case there much more, because :

    • SF 2.X is no longer maintained by SensioLabs
    • You must have a new major version of PHP ( 2.X is PHP 5/7) new you need PHP 8
    • A lot of core SF functionalities are changed ( flex, dependency injection ...)

    If it is possible for you to keep current project as legacy repo, and start new one from scratch, and copy part by part from legacy with new way.

    If keeping current project, is a must to do, I suggest that you migrate on several times ( from 2 to 3 from 3 to 4 ... ).

    I suppose there is no external tools that you use in this project (docker, api platform ....) ? If so you must be carful for that.