modules and '{{' table prefix

ive noticed that some modules, the yii-management-module uses this notation in the models to refer to the table names

the problem im having is im trying to import the modules into scope via




Yii::import('application.modules.user.models');

$settings=YumSettings::model()->findByPK(1);



the error always appears is

The table "{{yumsettings}}" for active record class "YumSettings" cannot be found in the database.

my question is what are the ‘{{tablename}}’ for ive seen them in many different modules, and it seems

if i access the module as intended ’ not importing into scope i guess’

everything works peachy.

how do i fix this, im importing because i need to access a property of the model in the module (say that 5x fast)

Hello,

Kinda late here with the answer but I think it is good to post the solution I found for the new lost souls to come with the same prob.

The key is to set the table names in the ‘user’ configuration in the ‘modules’ array in your proteccted/config/main.php:




modules=>array(

		...

		'user'=>array(

			...,

			'usersTable'=>'users',

			'profileTable'=>'profiles',

			'profileFieldsTable'=>'profile_fields',

			...

		),

),



By Yum 0.8, these are the table variables you can set (taken from UserModule.php):




	public $usersTable = 'users';

	public $settingsTable = 'yumsettings'

	public $textSettingsTable = 'yumtextsettings';

	public $messagesTable = 'messages';

	public $usergroupTable = 'usergroup';

	public $userUsergroupTable = 'user_has_usergroup';

	public $profileFieldsTable = 'profile_fields';

	public $profileFieldsGroupTable = 'profile_fields_group';

	public $profileTable = 'profiles';

	public $profileVisitTable = 'profile_visit';

	public $rolesTable = 'roles';

	public $friendshipTable = 'friendship';

	public $permissionTable = 'permission';

	public $actionTable = 'action';

	public $userRoleTable = 'user_has_role';

	public $userUserTable = 'user_has_user';

	public $roleRoleTable = 'role_has_role';

	public $activityTable = 'activities';



This is a quick & dirty fix. I don’t like it, but it works.

If the error is this, you have just to configure table prefix on your database.

Simply in your main.php add this:




'db'=> array(

   'connectionString'=>...

   'tablePrefix'=>''

),



This will make so that the table {{yumsettings}} will be correctly accessed like yumsettings