findManyToManyRowset

2 messages Options
Embed this post
Permalink
Roozbeh Matloobi

findManyToManyRowset

Reply Threaded More More options
Print post
Permalink
Hi,

I have 2 tables joined together but I dont know how to refrence them
through zend frame work.

I am calling $this->findManyToManyRowset('Subs',
'Client_Directories_Subs') function but I have bellow error

Uncaught exception 'Zend_Db_Table_Exception' with message 'No reference
from table Client_Directories_Subs to table Client_Directories' in
C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Abstract.php:397
Stack trace: #0
C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Row\Abstract.php(862):
Zend_Db_Table_Abstract->getReference('Client_Director...', NULL) #1
C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Row\Abstract.php(1073):
Zend_Db_Table_Row_Abstract->_prepareReference(Object(Client_Directories_Subs),
Object(Client_Directories), NULL) #2
C:\roozbeh\repo\newskool\repo\application\models\Client\Directories\Row.php(75):
Zend_Db_Table_Row_Abstract->findManyToManyRowset('Subs',
'Client_Director...') #3
C:\roozbeh\repo\newskool\repo\library\Modules\Client\Search\Lucene.php(56):
Client_Directories_Row->subs() #4
C:\roozbeh\repo\newskool\repo\application\modules\client\controllers\DirectoriesController.php(88):
Modules_Client_Search_lucene->rebuild() #5
C:\roozbeh\repo\newskool\repo\library\Zend\Contro in
*C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Abstract.php* on
line *397

much appriciate for any help

Thanks
*
Xolsom

Re: findManyToManyRowset

Reply Threaded More More options
Print post
Permalink
Usually you have to create a reference map like in this example: http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.defining

Which means that you have to add something like this in your DbTable model(Client_Directories_Subs):
protected $_referenceMap = array(
    'Sub' => array(
            'columns' => array('sub_id'),
            'refTableClass' => 'Subs',
            'refColumns' => array('sub_id')
    ),
    'Client_Directory' => array(
            'columns' => array('client_directory_id'),
            'refTableClass' => 'Client_Directories',
            'refColumns' => array('client_directory_id')
    ),
);

Roozbeh Matloobi wrote:
Hi,

I have 2 tables joined together but I dont know how to refrence them
through zend frame work.

I am calling $this->findManyToManyRowset('Subs',
'Client_Directories_Subs') function but I have bellow error

Uncaught exception 'Zend_Db_Table_Exception' with message 'No reference
from table Client_Directories_Subs to table Client_Directories' in
C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Abstract.php:397
Stack trace: #0
C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Row\Abstract.php(862):
Zend_Db_Table_Abstract->getReference('Client_Director...', NULL) #1
C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Row\Abstract.php(1073):
Zend_Db_Table_Row_Abstract->_prepareReference(Object(Client_Directories_Subs),
Object(Client_Directories), NULL) #2
C:\roozbeh\repo\newskool\repo\application\models\Client\Directories\Row.php(75):
Zend_Db_Table_Row_Abstract->findManyToManyRowset('Subs',
'Client_Director...') #3
C:\roozbeh\repo\newskool\repo\library\Modules\Client\Search\Lucene.php(56):
Client_Directories_Row->subs() #4
C:\roozbeh\repo\newskool\repo\application\modules\client\controllers\DirectoriesController.php(88):
Modules_Client_Search_lucene->rebuild() #5
C:\roozbeh\repo\newskool\repo\library\Zend\Contro in
*C:\roozbeh\repo\newskool\repo\library\Zend\Db\Table\Abstract.php* on
line *397

much appriciate for any help

Thanks
*