Yii Framework Forum: Why ver1.1 cannot insert ? - Yii Framework Forum

Jump to content

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

Why ver1.1 cannot insert ? Rate Topic: -----

#1 User is offline   yexin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 14-January 10

Posted 14 January 2010 - 03:52 AM

follow The Yii Blog Tutorial step by step, when i finished Creating and Updating Posts,but cannot insert any record to the DB.

So, I creat a simple test that only one table named test, using yiic shell, crud command to generate test. In ver1.0, it generate the model and controller and _form.php that can creat,update and list. But in 1.1, it generate the files too, but when i click the button create, nothing happened.

Any one tell me why? Thanks.
0

#2 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 14 January 2010 - 06:00 AM

In v1.1 model attributes must be declared as safe

<?php
  public function rules() {
    return array(
      array('title, description', 'safe'),
    );
  }

?>


See the guide
http://www.yiiframew...ute-assignments
0

#3 User is offline   yexin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 14-January 10

Posted 14 January 2010 - 08:09 PM

Thanks for your reply. I found the reason. The command in Tutorial is 'model *' and it generate the file 'Test.php'. The class name is 'class Test extends CActiveRecord' .But when I use command 'crud test', it generate the controller using 'test' everywhere. It's case sensitive. That is the problem confuse me some days.
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