DB_DataOBjects SelectAdd()

From: Date: Fri, 09 Sep 2005 05:35:55 +0000
Subject: DB_DataOBjects SelectAdd()
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20877@lists.php.net to get a copy of this message
Hi, I've been using DB_DataObjects now for a fait while (>12 mths). Recently we decided to use Structure_Datagrid to exchange some info with a thrid party. To do this I use the code below <code> beach= new DataObject_Beach_Details(); $photos = new DataObject_Photos(); $photos->whereAdd("Photo_type='Thumb' and photos.photo_id < 1279"); $beach_photos = new DataObject_Beach_photos(); $beach_photos->joinAdd($photos); $beach->joinAdd($beach_photos); $beach->selectAdd(); $beach->selectAdd('beach_details.beach_key,source as photo_file_name'); $beach->limit(5); $i= 1; $beach->debugLevel(1); if ($beach->find()) { $beach->debugLevel(0); while ($beach->fetch()) { // echo $beach->beach_key." : ".basename($beach->source)."<br>"; Var_Dump::display($beach->toArray()); } } </code> and the results look like :- <output> array(11) { beach_key => string(6) nsw001 photo_file_name => string(64) http://hpfm01/slsa/ABSAMP/images/beach_photos/thumbs/NSW-001.jpg segment => string(0) state => string(0) beach_name => string(0) description => string(0) swimming => string(0) surfing => string(0) fishing => string(0) summary => string(0) validity_date => string(0) } </output> In the above the empty columns are in the base table - beach_details. My issue is that when I bind to the DataGrid, all of the columns are listed, including all the empty columns. So, my question is can I setup the DBO so that I only get back the data in the selectAdd() clause? I'm also interested in knowing how to get the XML output from Structure_DataGrid not to render empty tags as this is bad xml. Todate I've resorted to hand writing the querys in DB, but that seems a little defeatist. THanks in advance, and keep up the sensational work. -- Stay happy, stay well ... get involved Barry Steele www.hpfm.com.au mob: +61 413 947980 off: +61 2 99816329 fax: +61 2 9981 7806

« previous php.pear.general (#20877) next »