Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-19-2008, 08:28 AM
Junior Member
 
Join Date: Apr 2008
Posts: 28
Default findManyToManyRowset bug?

Hello,

I was wondering if findManyToManyRowset only works in a 1 way direction? Because sometimes it works and other times it doesn't. I don't know what the problem is with my code.


So we've got 3 table classes

Licenties
ProductVersies
Producten

1 'licentie' is connected to 1 'productVersie' which is connected to 1 product.

So I need to know what product is connected to the license.

So My code is the following

Code:
$productRow = $licentieRow->findProductenViaProductVersies();
I've also tried


Code:
$productRow = $licentieRow->findManyToManyRowset('Producten','ProductVersies')->current();
The Zend_db_Table classes involved are...
Code:
class Licenties extends Zend_Db_Table_Abstract
{
	/**
	 * The default table name 
	 */
    protected $_name				= 'licenties';
    protected $_primary 			= 'ID';
    
    protected $_dependentTables 	= array('LicentiesMgt');
    
    protected $_referenceMap   		= array(
        'Locatie' => array(
            'columns'       	    => 'locatie_ID',
            'refTableClass' 	    => 'Locaties',
            'refColumns'            => 'ID'
        ),
        'Product' => array(
            'columns'		        => 'product_versie_ID',
            'refTableClass'  	    => 'ProductVersies',
            'refColumns'            => 'ID'
        ),
        'LicentieType' => array(
        	'columns'				=> 'licentie_type_ID',
        	'refTableClass'			=> 'LicentieTypes',
        	'refColumns'			=> 'ID'
        ));
Code:
class ProductVersies extends Zend_Db_Table_Abstract
{
	/**
	 * The default table name 
	 */
    protected $_name 			= 'product_versies';
    protected $_primary 		= 'ID';
    protected $_rowClass		= 'ProductVersiesRow';
    protected $_dependentTables = array('ProductVersieBestanden', 'Licenties');
    
    protected $_referenceMap   	= array(
        'Product' => array(
            'columns'       	=> 'product_ID',
            'refTableClass' 	=> 'Producten',
            'refColumns'        => 'ID'
        ));
Code:
class Producten extends Zend_Db_Table_Abstract
{
	/**
	 * The default table name 
	 */
    protected $_name 			= 'producten';
    protected $_primary 		= 'ID';
    
    protected $_dependentTables = array('ProductVersies');
$licentieRow is not null (verified this with a var_export) it holds a row of licentie.

The error I'm getting is

Code:
Fatal error: Uncaught exception 'Zend_Db_Table_Exception' with message 'No reference from table ProductVersies to table Licenties' in C:\xampp\htdocs\Stage\library\Zend\Db\Table\Abstract.php:349
So apparently there is no reference in the Zend_Db_Classes between ProductVersies & Licenties.... But All seems correctly configured. Anybody has any clue why this doesn't work?

Licenties <-- 1 To Many ---> productVersies
ProductVersies <--Many to 1 --> Producten

All relationships are 1 to Many (or vice versa) since 1 to 1 isn't possible in MySQL.



Ideas are welcome. I can of course always get the rows with 2 finds .... but that seems like a huge waste of code & resource when you've got something as handy like the ManyToMany method?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:08 PM.