Open GoogleCodeExporter opened 9 years ago
jacko87,
thanks for posting this up!
when i go to:
/usergroup/groups/index
(after a group has been created) then the model tries to pull any related
messages using usergroupMessages.
I was receiving the error that $_tableName wasn't defined in
YumUsergroupMessage. After trial and error I found the following to work:
/**
* Returns resolved table name (incl. table prefix when it is set in db configuration)
* Following algorith of searching valid table name is implemented:
* - try to find out table name stored in currently used module
* - if not found try to get table name from UserGroupModule configuration
* - if not found user default {{user_group}} table name
* @return string
*/
public function tableName()
{
if (isset(Yum::module()->usergroupMessagesTable))
//$this->_tableName = Yum::module()->usergroupMessagesTable;
$_tableName = Yum::module()->usergroupMessagesTable;
elseif (isset(Yii::app()->modules['usergroup']['usergroupMessagesTable']))
//$this->_tableName = Yii::app()->modules['usergroup']['usergroupMessagesTable'];
$_tableName = Yii::app()->modules['usergroup']['usergroupMessagesTable'];
else
//$this->_tableName = '{{user_group_message}}'; // fallback if nothing is set
$_tableName = '{{user_group_message}}';
$_tableName = '{{user_group_message}}'; // fallback if nothing is set
return Yum::resolveTableName($_tableName, $this->getDbConnection());
//return '{{user_group_message}}';
}
essentially, creating a variable in the function and removing the $this->
hope that helps someone else.
Original comment by allen.br...@gmail.com
on 24 Feb 2012 at 2:44
Original issue reported on code.google.com by
jacko87
on 3 Dec 2011 at 5:52