8

How to upgrade Yii 1.x version to Yii 2.0 latest release version? I am using ubuntu OS , Process to updating my old Yii to new Yii release version 2.0?

Nana Partykar
  • 10,175
  • 8
  • 43
  • 73
Pawan Shukla
  • 123
  • 1
  • 1
  • 8

1 Answers1

19

The Yii2 guide has excellent documentation in this regard see Upgrade from v1

I recently migrated couple of moderately complex applications from Yii 1.x to Yii 2.0. There are two ways to go about it , either you can run Yii 1.x and Yii 2 at the same time see using-yii-2-with-yii-1. Then migrate part by part, while it is possible it was quite bit of pain, like trying to rebuild the second floor while living on the third.

Alternatively you can rewrite the entire application bottom up with the exact same functionality, I found this to be much more efficient, significant code could be reused with only minor modifications, also that gave opportunity to tweak the design without changing functionality.

The important thing is to ensure the exposed API ( i.e. the frontend / UI / functionality) remains the same. It is always tempting to update functionality or change features during a rewrite, however if you stick to strictly reimplementing everything for Yii2 then consider changing your API, your migration will be smoother.

Manquer
  • 6,902
  • 6
  • 39
  • 67
  • Would it be possible for you eyeball the time to do a rewrite based on existing Yii 1 code, relative to the time it took to build initially? Do you think it's 1/3 the time? 3/4? – Dan Ray Mar 29 '17 at 18:24
  • 1
    it really depends on how well your Yii 1 application is written, whether it is well designed fat models and thin controllers, proper separation of concerns etc, if you do just rewrite, it should be doable in less than half the original time, assuming the layouts and UI will be same. – Manquer Apr 02 '17 at 14:16
  • We're doing it right now, with a slightly different approach. In a few months I'm gonna report how it turned out to be a lot of pain or not, but the concept behind is an intermediate class (we call it Yang) that mimics the behaviour of Yii1, acting simply as a wrapper around its calls, and then we bridge the differences to Yii2 within this one class. Again, not sure this will work out perfectly but it's the best we could come up with to keep the production versions running while going forward with Yii2 testing & reduce git divergence from the project backbone. – dkellner Mar 20 '20 at 07:57