Changes
Title
unchanged
How to make customizable Db Table prefixes using ActiveRecord
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
Content
changed
> Note: As of Yii 1.1.x this functionality is integrated into the framework. If you are using 1.1.x please disregard this article and use the built-in functionality.
> Note: The method described on this page involves extending Core classes to create custom functionality. This method is best used when starting new projects, but can be implemented after a product has been developed. It's just more work to do it later on.
Yii's ActiveRecord classes are powerful, but they fall short when you want to have a configurable table prefix for your application.[...]
// Prepend prefix, call our new method
return (self::$$this->tbl_prefix . $this->_tableName());
}
/**
* Function for child classes to implement to return the table name associated with it
*/[...]