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

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

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.

:)

please checkout below link

http://www.yiiframework.com/forum/index.php/topic/4600-urgent-cdbexception-the-table-for-active-record-class-cannot-be-found-in-the-database/page__p__24282__hl__%2Btable+%2Bfor+%2Bactive+%2Brecord+%2Bclass+%2Bcannot+%2Bbe+%2Bfound+%2Bin+%2Bthe+%2Bdatabase__fromsearch__1#entry24282