Yii Framework Forum: Moving To 2.0, Manually? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Moving To 2.0, Manually?

#1 User is offline   darioo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 10-July 13

Posted 19 October 2013 - 06:27 PM

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
0

#2 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 478
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 20 October 2013 - 01:24 AM

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.
2

#3 User is offline   Fragoulas 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 11-July 11

Posted 20 October 2013 - 03:49 AM

View Postdarioo, on 19 October 2013 - 06:27 PM, said:

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


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.
0

#4 User is offline   darioo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 10-July 13

Posted 20 October 2013 - 04:49 AM

Oh damn, but thank you for you answers
0

#5 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,338
  • Joined: 17-January 09
  • Location:Russia

Posted 20 October 2013 - 11:57 AM

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.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#6 User is offline   pappleton 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 14-January 10
  • Location:England

Posted 28 October 2013 - 06:35 AM

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.
0

#7 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,338
  • Joined: 17-January 09
  • Location:Russia

Posted 28 October 2013 - 08:39 AM

Good plan.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#8 User is offline   pappleton 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 14-January 10
  • Location:England

Posted 23 April 2014 - 07:03 AM

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users