-1

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.

Gopal
  • 3
  • 4
  • How many entities are we talking about here? There is a lot more that has changed since 2.3. My inclination might be to just start with a fresh 6.3 app and rebuild the entities manually. If nothing else that would give you some familiarity with the app. That would work with a few dozen entities. Not so much with a few thousand. – Cerad Aug 22 '23 at 12:51
  • @Cerad we are having almost 260 plus entities in current application, and earlier we used Oracle 11g database and now we will be using PostgreSQL. So, what will be your suggestions on entity migration from old to latest Symfony version? – Gopal Aug 22 '23 at 13:16
  • I can only offer an opinion and opinions don't do well on stackoverflow. I'm assuming that you are the new kid on the block and someone told you to upgrade the project probably as a test of some sort. Otherwise a Symfony consultant would be called in. Regardless I would try to recreate a tiny portion of the app using 6.3 just to get an idea of what needs to be changed. You probably won't find a magic solution. Good luck. – Cerad Aug 22 '23 at 13:45
  • @Cerad, really appreciate for your opinion. I am not only one in this project for migration there are other seniors as well. But, they given me task for entity migration from old to new Symfony. Important key upgrade steps also helpful for me as a new to MVC. Key upgrade steps to start from baby steps to advance level will definitely work for me. – Gopal Aug 22 '23 at 14:09
  • I have worked on quite a few symfony migrations for big projects, including SF2 to SF6. You could migrate gradually using symfony UPGRADE note on github (as well as read a few articles about it, especially about using tools such as rector), but it would mean migrating the whole framework step by step, I'm not sure why you are speaking about just "migrating entities" and not symfony itself. Also while it's a good way to learn about symfony (and how it changed overtime), migrating so many major versions as a beginner in symfony could be quite difficult, compared to creating a new project. – Dylan KAS Aug 24 '23 at 09:00
  • @DylanKAS, Thanks for your opinion. Actually, we are migrating a whole application only but entity migration was on of task that they given to me. Anyways, we are planning to refer an existing old application and rebuild the same on latest symfony and php versions. This should be better approach to migrate the big application. Thanks all for giving genuine opinion. – Gopal Sep 01 '23 at 05:00

1 Answers1

-1

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.

Ahmed Kallali
  • 79
  • 1
  • 5