Moving To 2.0, Manually?

I was wondering, when Yii 2.0 releases how will procedure with transferring from 1.1 to 2.0 look like. Will I have to manually change everything?

I’ve seen lot’s of things have changes. e.g. it’s not CHtml now it is Html

When you update a project from 1.1 to 2.0 you will have to change a lot. Would only be worth it for really long term project but you may better consider making a next major version of your project and writing it new based on yii2 if you do.

In general Yii 2 is ment for new Projects and your old Projects should stay yii 1.1. which is supported until 2016.

Simply do not! I am pretty sure it does not worth the effort. It will be like moving the project from Yii 1.1 to Symphony or whatever. It is a totally different framework IMO and you should not fall into the trap.

Use it on your new projects when it becomes stable.

Oh damn, but thank you for you answers

It’s not totally new i.e. ideas are still mostly the same and many good components are behaving like they were in 1.1.

I am planning to move to Yii2. My approach is to move as much logic out of the Controllers and Views in preparation as possible. Its probably good practice anyway. Also ‘code once’ dont repeat anything - so there is only one place to change. For example have common data access and validation functions outside the generated code. Hopefully I will be able to regenerate the MVC and insert single line calls into the generated code. I think its a good excuse to refactor your whole application and see how tidy you can make it.

Good plan.

A user named Justin asked me to elaborate on my answer. I’m afraid its not a magic solution but here goes:


//MessyMyController.php

public function actionIndex()

{

// Get Data

.. Lots of code

// Validate Data

.. Lots of code

// Update Data

.. Lots of code

return $this->render('index');

}

// Lots more functions in MessyMyController.php that are not generated ie not actionXXXXXXX.

..


//Cleaner approach

//Move the majority of code to a separate source file eg mymodule.php


//TidyMyController.php

require mymodule.php


public function actionIndex()

{

myModule->handleIndex();

return $this->render('index');

}

So when the MyController.php is regenerated by Yii2 you only need to add the lines:

require mymodule.php

myModule->handleIndex();

Of course there will be plenty more work but it should be clearer.

Note: the AutoLoader means you dont have to use the require but I’m just trying to illustrate a concept.