Yii Framework Forum: The table "user" for active record class "User" cannot be found in the database. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

The table "user" for active record class "User" cannot be found in the database. The table "user" for active record class "User" cannot Rate Topic: -----

#1 User is offline   coasa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 12-January 11

Posted 04 March 2011 - 03:27 PM

Hi, i faced this problem when upgrading to yii-1.1.6.r2877



The table "user" for active record class "User" cannot be found in the database.

C:\wamp\www\homs\yii\framework\db\ar\CActiveRecord.php(2168)

2156 private $_model;
2157
2158 /**
2159 * Constructor.
2160 * @param CActiveRecord $model the model instance
2161 */
2162 public function __construct($model)
2163 {
2164 $this->_model=$model;
2165
2166 $tableName=$model->tableName();
2167 if(($table=$model->getDbConnection()->getSchema()->getTable($tableName))===null)
2168 throw new CDbException(Yii::t('yii','The table "{table}" for active record class "{class}" cannot be found in the database.',
2169 array('{class}'=>get_class($model),'{table}'=>$tableName)));
2170 if($table->primaryKey===null)
2171 $table->primaryKey=$model->primaryKey();
2172 $this->tableSchema=$table;
2173 $this->columns=$table->columns;
2174
2175 foreach($table->columns as $name=>$column)
2176 {
2177 if(!$column->isPrimaryKey && $column->defaultValue!==null)
2178 $this->attributeDefaults[$name]=$column->defaultValue;
2179 }
2180
0

#2 User is offline   coasa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 12-January 11

Posted 04 March 2011 - 03:33 PM

Hi, i already found the bug, i am using oracle 10g, for some reason tables appears uppercase when searching for the tables names in yii-1.1.6. So here is the fix.

in the Model Class "User", i replace this:

public function tableName()
{
return 'user';
}

For this:
public function tableName()
{
return 'USER';
}

this was the solution i found.. if there is any other way, please let me know.

:)
0

#3 User is offline   charles07 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 05-February 12

Posted 22 May 2012 - 11:39 PM

please checkout below link

http://www.yiiframew...h__1#entry24282
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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