Issues

ZF-1156: Table_Row should be able to store dependent/parent rowsets

Description

Hi,

I think that a great improvement for table relationship would be to store and be able to access to the dependent rows within parent row object.

with the example of the manual we could have :


$tableAccount = new Accounts();
$anAccount = $tableAcount->find(1)->current();

and have in the Zend_Db_Table_Row object a detection of accessor like following that would fetch and store the dependent rows on the first call (and maybe also with a refresh method) :



same idea with parent rows :

in a second time we could imagine to be able to update dependent rows not only for primary key changes if using the where clause generated from the referenceMap (already implemented in the findDependantRowset). For example we would be able to add a dependent row for a parent row object :


$newBug = $tableBugs->fetchNew();
$newBug->bug_description = 'a description';
$newBug->bug_status = 'OPEN';
...
$aProduct->dependentBugs->add($newBug); 

This last call could set the product_id value in $newBug if Zend_Db_Table_Rowset had stored the where clause used to fetch it (so with primary key value of the parent row)

Then ``` would add the new bug for this product;

I'm aware that it implies quite major modifications but I think this is really a must have functionality.

Wandrille

Comments

This is a pretty fancy new feature. I have changed the issue type to 'new feature'.

This is part of being an object-relational mapping (ORM), and Zend_Db_Table has a long way to go to provide that functionality. The scope of work for Zend_Db_Table is to provide the Table Data Gateway and Row Data Gateway patterns, not a fully features ORM.

That would be a really great product, but we cannot do this in the short term with Zend_Db. I will leave the issue open though and perhaps someday we will do it.

Please categorize/fix as needed.

Reassigning to Ralph since he's the new maintainer of Zend_Db

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.