DataObject::getLinks() usage

From: Date: Mon, 24 Feb 2003 13:49:31 +0000
Subject: DataObject::getLinks() usage
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3912@lists.php.net to get a copy of this message
Hi, Done a search in the mailing list archive but found nothing which solves a problem I have. I've created all my database tables in the relevant format as stated in the pear.php.net docs for the DB_DataObject. I have a table with a field named 'traveldestination_id'. I assume the DataObject class should allow me to link this to the table traveldestination.id field? My question is exactly where do I use the getLinks() method? From the documentation it appears that I do *not* have to waste time creating a links .ini file either if I use getLinks(), rather than getLink() - is this right? I set up my query, call find, and loop through the results (there are multiple results). Here's my test code:- function getVaccinations($destinationId) { $db = new DO_Traveldisdestimmrec; $db->traveldestination_id = $destinationId; $db->find(); while ($db->fetch()){ print_r($db);echo '<br><br>'; } } The fetched results never seem to have the embedded object of the traveldestination table. It just has the traveldestination_id = '2'. Why? From the first fetch() call I get... object(do_traveldisdestimmrec)(19) { ["_DB_DataObject_version"]=> string(3) "1.0" ["__table"]=> string(19) "traveldisdestimmrec" ["N"]=> int(1) ["_database_dsn"]=> string(0) "" ["_database_dsn_md5"]=> string(32) "963e070b0532b2a12e97394826f880f9" ["_database"]=> string(3) "pma" ["_condition"]=> string(0) "" ["_group_by"]=> string(0) "" ["_order_by"]=> string(0) "" ["_limit"]=> string(0) "" ["_data_select"]=> string(1) "*" ["_DB_resultid"]=> int(1) ["_link_loaded"]=> bool(false) ["_join"]=> string(0) "" ["_lastError"]=> bool(false) ["traveldisease_id"]=> string(1) "1" ["traveldestination_id"]=> string(1) "2" ["travelimmrec_id"]=> string(1) "2" ["id"]=> string(2) "14" } The current online documentation is very patchy at times - who is responsible for keeping it up to date? Bye, -- Mike Carter [web developer] tel: 01925 758229 // fax: 01925 758023 // web: www.koa.uk.com This message is confidential. Unless you are the named addressee or their delegated representative you may not use, disclose, or copy the contents of the e-mail. If you are not the named addressee please notify the sender immediately and delete the material from your computer. Any views or opinions contained in this e-mail are solely those of the author unless expressly stated otherwise ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________

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