Issue Details (XML | Word | Printable)

Key: ZF-2925
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Ralph Schindler
Reporter: Jacob Oettinger
Votes: 5
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Problem using join in Zend_Db_Table

Created: 19/Mar/08 11:53 AM   Updated: 19/May/09 10:54 AM   Resolved: 18/May/09 03:46 PM
Component/s: Zend_Db_Select, Zend_Db_Table
Affects Version/s: 1.5.0
Fix Version/s: 1.8.2

Time Tracking:
Not Specified

Issue Links:
Dependency
 

Fix Version Priority: Should Have


 Description  « Hide

The functionality described in example 10.96 in the reference guide does not work.
The code:
<?php
$table = new Bugs();

$select = $table->select();
$select->where('bug_status = ?', 'NEW')
->join('accounts', 'accounts.account_id = bugs.reported_by')
->where('accounts.account_name = ?', 'Bob');

$rows = $table->fetchAll($select);

Results in a simple select * from the accounts table where account_name = "Bob", the join is ignored.

A possible workaround is to use an explicit ->from() call on the select object. Like this:
$select->from('bugs');

The query is now correctly formatted as a join query but it selects all columns from both bugs and accounts. This seems like a reasonable default behavior for the select object, but in the above usage it is required that only columns from bugs is returned to create a writable row object. The ->setIntegrityCheck(false) method to allow creation of read only rows with columns from both tables, but this is not the very useful behavior described in the reference guide.

Possible solution:

  • Make the select object returned from a table object contain a from part by default.
  • Alter the documentation-code so that no columns are added from the joined table (how is this is done?)


Sort Order: Ascending order - Click to sort in descending order
Wil Sinclair made changes - 25/Mar/08 08:43 PM
Field Original Value New Value
Assignee Darby Felton [ darby ]
Darby Felton made changes - 02/Apr/08 02:52 PM
Assignee Darby Felton [ darby ] Simon Mundy [ peptolab ]
Darby Felton made changes - 02/Apr/08 02:52 PM
Fix Version/s Next Mini Release [ 10161 ]
Ralph Schindler made changes - 22/Jul/08 07:03 AM
Fix Version Priority   Should Have
Alexander Veremyev made changes - 28/Jul/08 09:53 AM
Fix Version/s Next Mini Release [ 10201 ]
Fix Version/s Next Mini Release (1.5.3) [ 10161 ]
Tim Fisken made changes - 22/Aug/08 04:51 PM
Link This issue depends on ZF-2546 [ ZF-2546 ]
Alexander Veremyev made changes - 15/Sep/08 02:52 PM
Fix Version/s Next Mini Release [ 10250 ]
Fix Version/s 1.6.1 [ 10201 ]
Wil Sinclair made changes - 06/Jan/09 10:48 AM
Assignee Simon Mundy [ peptolab ] Ralph Schindler [ ralph ]
Alexander Veremyev made changes - 19/Jan/09 11:16 AM
Fix Version/s Next Mini Release [ 10272 ]
Fix Version/s 1.7.3 [ 10250 ]
Alexander Veremyev made changes - 18/Feb/09 09:41 AM
Fix Version/s Next Mini Release [ 10290 ]
Fix Version/s 1.7.5 [ 10272 ]
Alexander Veremyev made changes - 02/Mar/09 11:37 AM
Fix Version/s Next Mini Release [ 10291 ]
Fix Version/s 1.7.6 [ 10290 ]
Alexander Veremyev made changes - 17/Mar/09 09:46 AM
Fix Version/s Next Mini Release [ 10300 ]
Fix Version/s 1.7.7 [ 10291 ]
Alexander Veremyev made changes - 30/Mar/09 02:31 PM
Fix Version/s Next Mini Release [ 10310 ]
Fix Version/s 1.7.8 [ 10300 ]
Alexander Veremyev made changes - 13/May/09 06:11 AM
Fix Version/s Next Mini Release [ 10330 ]
Fix Version/s 1.8.1 [ 10310 ]
Ralph Schindler made changes - 18/May/09 03:46 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]