Home > Backend Development > PHP Tutorial > Yii框架更动数据类型

Yii框架更动数据类型

WBOY
Release: 2016-06-13 12:58:40
Original
791 people have browsed it

Yii框架更改数据类型
之前数据库有个字段是数值型,我用YII的工具GII把它生成,model,conttroler,view等层。后来由于项需求,要把数值改为字符串,于是我就把数据库的数值型改为字符型(char型)。然后把model层的 rules()方法下的数组:array('AA,BB, ', 'numerical'),

改为:

array('AA,BB','length','max'=>20),

最后我输入字符提效数据时,出现如下的错误:

CDbException
列名必须是一个字符串或者数组 

D:\web_root\rd1039b\framework\db\schema\CDbCommandBuilder.php(701)

689             }
690             if(count($values)===1)
691             {
692                 $entries=array();
693                 foreach($values[0] as $name=>$value)
694                     $entries[]=$prefix.$table->columns[$name]->rawName.($value===null?' IS NULL':'='.$value);
695                 return implode(' AND ',$entries);
696             }
697 
698             return $this->createCompositeInCondition($table,$values,$prefix);
699         }
700         else
701             throw new CDbException(Yii::t('yii','Column name must be either a string or an array.'));
702     }
......
.......
......
.....
......
CActiveRecord->save() 
249             }
250             
251                 
252                 if (Yii::app()->user->ROLE==STUDY_USER_ROLE_PI){
253                     $model->ENTRY2WHO= Yii::app()->user->USERNAME;
254                         if ($model-> save())
255                         {
256                             if($SORT!=3){
257                             $this->ToDo($Name,$MH1,$keyid);
258                             }
259                             else
.........
..........
........
.......
.
请问高手,这是什么原因呀?请帮忙,谢谢啊!!
------解决方案--------------------

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template