migrate yii1 to yii2

Hi All,

I have big enterprise application coded in Yii 1.1.14, and this application has been serving us for almost 10 yrs already.

Now we are planning to upgrade to Yii 2. Could you guys help me on the best steps to do in migrating to Yii 2.

Is there generator or extension that can help me.

Sorry for my bad English :)

Thank you in advance for your help.

There is official document available online

Here are some important code snippets:




1) Modification of entry script:


// include the customized Yii class described below

require(__DIR__ . '/../components/Yii.php');


// configuration for Yii 2 application

$yii2Config = require(__DIR__ . '/../config/yii2/web.php');

new yii\web\Application($yii2Config); // Do NOT call run()


// configuration for Yii 1 application

$yii1Config = require(__DIR__ . '/../config/yii1/main.php');

Yii::createWebApplication($yii1Config)->run();

2) Combination of Yii classes:


$yii2path = '/path/to/yii2';

require($yii2path . '/BaseYii.php'); // Yii 2.x


$yii1path = '/path/to/yii1';

require($yii1path . '/YiiBase.php'); // Yii 1.x


class Yii extends \yii\BaseYii

{

    // copy-paste the code from YiiBase (1.x) here

}


Yii::$classMap = include($yii2path . '/classes.php');

// register Yii 2 autoloader via Yii 1

Yii::registerAutoloader(['Yii', 'autoload']);

// create the dependency injection container

Yii::$container = new yii\di\Container;



Usage of Yii class:




echo get_class(Yii::app()); // outputs 'CWebApplication'

echo get_class(Yii::$app);  // outputs 'yii\web\Application'



Thank you very much!