Also available in these languages:
DeutschEnglishEspañolFrançaisBahasa Indonesia日本語polskiPortuguêsRomâniaРусскийsvenska简体中文

Upgrading from Version 1.0 to 1.1

  • Removed CModel::safeAttributes(). Safe attributes are now defined to be those that are being validated by some rules as defined in CModel::rules() for the particular scenario.

  • Changed CModel::validate(), CModel::beforeValidate() and CModel::afterValidate(). CModel::setAttributes(), CModel::getSafeAttributeNames() The 'scenario' parameter is removed. You should get and set the model scenario via CModel::scenario.

  • Changed CModel::getValidators() and removed CModel::getValidatorsForAttribute(). CModel::getValidators() now only returns validators applicable to the scenario as specified by the model's scenario property.

  • Changed CModel::isAttributeRequired() and CModel::getValidatorsForAttribute(). The scenario parameter is removed. The model's scenario property will be used, instead.

  • Removed CHtml::scenario. CHtml will use the model's scenario property instead.

  • By default, a single JOIN statement will be generated and executed for all relations involved in the eager loading. If the primary table has its LIMIT or OFFSET query option set, it will be queried alone first, followed by another SQL statement that brings back all its related objects. Previsoulay in version 1.0.x, the default behavior is that there will be N+1 SQL statements if an eager loading involves N HAS_MANY or MANY_MANY relations.
  • The default alias for a relational table is now the same as the corresponding relation name. Previously in version 1.0.x, by default Yii would automatically generate a table alias for each relational table, and we had to use the prefix ??. to refer to this automatically generated alias.

  • The alias name for the primary table in an AR query is fixed to be t. Previsouly in version 1.0.x, it was the same as the table name. This will cause existing AR query code to break if they explicity specify column prefixes using the table name. The solution is to replace these prefixes with 't.'.

  • For attribute names, using Field[$i] is not valid anymore, they should look like [$i]Field in order to support array-typed fields (e.g. [$i]Field[$index]).

Other Changes

  • The signature of the CActiveRecord constructor is changed. The first parameter (list of attributes) is removed.
$Id: upgrade.txt 1819 2010-02-18 22:56:55Z qiang.xue $
If you found any typos or errors in the tutorial, please create a Yii ticket to report it. If it is a translation error, please create a Yiidoc ticket, instead. Thank you.

Total 4 comments:

#772
NICE: Changes Related with Tabular Input
by nobita at 10:31pm on October 27, 2009.

I would love the 'Changes Related with Tabular Input'. I have recently run into the scenario where I have a model with dynamic attributes, which is an array. It fetches names and values from the database. So I had to modify CHtml and override __get and __set of the Product model itself in order to prevent CHtml::textField from misunderstanding the indexed attribute with multiple models. I'll take a look at your new implementation. Thank you!

#1063
Concern for backward compatbility
by drp666c at 2:28am on February 3, 2010.

I am currently in development stage with 1.0.9.r1396 and am debating to go to 1.1 with reservations. More importantly, if I invest time to move to 1.1 will 1.2 be 100% backward compatible with 1.2 or are we going to have to face the same hurdle for each incremental release?

BTW: Thanks for sharing the amazing framework; it truly enables me to do things that would otherwise be very time consuming.

#1082
Typo in article
by intel352 at 2:53am on February 8, 2010.

"Previsoulay" should be "Previously"

#1122
Error in Spanish
by horacio.segura at 2:45am on February 17, 2010.

the link Español of menu give error: http://www.yiiframework.com/doc/guide/es/upgrade

Your Comment:

You may enter comment using Markdown syntax.

Please login with your forum account.
Note: you must have at least ONE forum post with your account.