|
|||
|
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(); Code:
$productRow = $licentieRow->findManyToManyRowset('Producten','ProductVersies')->current();
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');
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 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? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|