Hi,
I think it would be very useful if CActiveRecord have a $schemaName attribute or schemaName function, so we can explicitily define our schema name (Oracle and Postgres db uses schemas very much - and this information is very important!).
Then, our AR could be defined this way:
class xxx extends CActiveRecord
{
public function schemaName()
{
return 'mytableSchemaX';
}
public function aliasName()
{
return 'mytableNameX';
}
This way, if we have many tables inside a schema, we can create a superclass for the schema:
abstract class MySchemaX extends CActiveRecord
{
public function schemaName()
{
return 'mySchemaX';
}
}
And inherit every table inside the schema from this superclass:
class MyTable extends MySchemaX
{
public function tableName()
{
return 'mySchemaX';
}
}
If we can do this, every time we change the schema name, we simply redefine our superclass definition.
Actually, it’s boring to define our table names like:
class xxx extends CActiveRecord
{
public function aliasName()
{
return 'myschemaX.mytableNameX';
}
The code above is not very reusable.
Also, AR should have a method to return the "full name" of the table, like a "$model->fullTableName" or "$model->rawTableName"