ZF-2925: Problem using join in Zend_Db_Table
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?)