ZF-7018: Zend_Db_Table should fetch related objects

Issue Type: New Feature Created: 2009-06-15T05:53:37.000+0000 Last Updated: 2009-06-18T04:19:15.000+0000 Status: Resolved Fix version(s): Reporter: Romain Fromi (fromi) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Table

Related issues: Attachments:


Many users ask for how to write a join request with Zend_Db_Table->select(). For now it is not possible to join foreign column to a table select statement unless you call setIntegrityCheck(false). Even so, the result is having one corrupted Zend_Db_Table_Row instance with all column. I expected to have a non corrupted Zend_Db_Table_Row with the foreign attribute being a reference to a second non corrupted Zend_Db_Table_Row.

Let have an exemple : We have to tables : Bugs(bug_id, title, author_id) and Authors(author_id, name). I want to fetch all Bug table entries.

I can write :

<pre class="highlight">
$bug = new DbTable_Bugs();
$bugs = $bug->fetchAll();
for each ($bugs as $bugRow)  {

But, this way I will do 1 + n queries to the database : 1 for the fetchAll query, n being every findParentRow queries. The solution would be something like :

<pre class="highlight">
$bugs = $bug->fetchAllJoinAuthor();

and then findParentRow do not require any other queries, every rows needed whould have already been created and linked together.

Today I am nearly sure this feature does not exist yet (but I may be wrong). I think that Zend_Db_Table_Row do not support foreign rows. It would be great if Zend_Db could run the same as Propel does in the following exemple (my inspiration for this thread) : […]


Posted by Romain Fromi (fromi) on 2009-06-18T04:19:14.000+0000

I made up my mind and found a Component proposal on the wiki which is an answer to my problem :…

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.