sarvan75 / yii-user-management

Automatically exported from code.google.com/p/yii-user-management
0 stars 0 forks source link

YUM have a wrong friendship module/model code #177

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Yii WebApp and Install YUM using custom name tables.
2. After Install YUM, Installer generate a new module configuration to save in 
main.php
3. Go to http://localhost/webapp/index.php/user/user/index , log and click in 
Social -> My friends.

What is the expected output? What do you see instead?
I see a error than says {{friendship}} table dont exists. I check code and i 
see some errors in YumFriendship and FriendshipModule classes.
YumFriendship class original code:

public function tableName()
    {
        if(isset(Yum::module()->friendshipTable))
            $this->_tableName = Yum::module()->friendshipTable;
        elseif(isset(Yii::app()->modules['user']['friendshipTable']))
            $this->_tableName = Yii::app()->modules['user']['friendshipTable'];
        else
            $this->_tableName = '{{friendship}}'; // fallback if nothing is set

        return Yum::resolveTableName($this->_tableName, $this->getDbConnection());
    }

It would be:

public function tableName()
    {
        if(isset(Yum::module('friendship')->friendshipTable))
            $this->_tableName = Yum::module('friendship')->friendshipTable;
        elseif(isset(Yii::app()->modules['user']['friendshipTable']))
            $this->_tableName = Yii::app()->modules['user']['friendshipTable'];
        else
            $this->_tableName = '{{friendship}}'; // fallback if nothing is set

        return Yum::resolveTableName($this->_tableName, $this->getDbConnection());
    }

FriendshipModule has not a $friendshipTable public property. I added this code:

public $friendshipTable = '{{friendship}}';

What version of the product are you using? On what operating system?
Yii 1.1.8, YUM r417. Windows XP SP 3 with XAMPP 1.7.1

Original issue reported on code.google.com by jacko87 on 3 Dec 2011 at 5:40

GoogleCodeExporter commented 9 years ago
I encountered this issue as well, thanks for the fix!

Original comment by JJHayes...@gmail.com on 23 Dec 2011 at 5:49

GoogleCodeExporter commented 9 years ago
thanks for this fix! just integrated it into SVN revision 420

Original comment by thyseus on 23 Dec 2011 at 11:10