Hi Jack

The answer to this is a big yes. Here's an example I had in the documentation, it assumes we're trying to find all bug reports that have been newly submitted by a user called 'Bob'. The foreign key is bugs.reported_by which corresponds to accounts.account_id. It returns a 'normal' rowset, of which each row is writeable as normal. It works fine on a one-to-one or even a one-to-many (as long as you've grouped the results!)

<?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')
       ->group('bugs.id');

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

Cheers

Hey,
This looks great, thanks! One question that relates to something I thought would be good the other day: Will these enhancements allow you to retrieve a set of writeable rows as the result of a join based condition. ie. All the rows from table A, where a condition on table B is true (for the sake of this example assume table A and B have a one to one relationship)?

--

Simon Mundy | Director | PEPTOLAB

""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com

Reply via email to