Hi!
I was wondered when I tried to configure the tablePrefix property and after that I saw an exception :
"The table "{{users}}" for active record class "Users" cannot be found in the database".
It doesn’t work neither in PDA nor in Active Records. That’s my configuration from main.php file:
'db'=>array(
'class'=>'CDbConnection',
'connectionString'=>'pgsql:host=localhost;port=5432;dbname=postgres',
'username'=>'postgres',
'password'=>'root',
'charset'=>'utf8',
'tablePrefix'=>'rtc_',
),
Table name is "rtc_users". And i write in SiteController.php:
$connection=new CDbConnection(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
$connection->active=true;
$post=new Users;
$post->username='admin';
$post->email='admin@admin.ru';
$post->save();
And that’s models/Users.php file:
<?php
class Users extends CActiveRecord
{
public static function model($className=__CLASS__)
{
return parent::model($className);
}
public function tableName()
{
return '{{users}}';
}
}