DB_Object linking question

From: Date: Wed, 22 Dec 2004 19:39:34 +0000
Subject: DB_Object linking question
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16420@lists.php.net to get a copy of this message
I have two tables, building and rooms. There can be more than one room per building. The structure is shown below in database.ini, as well as the database.links.ini and code. The problem is that the rooms are displaying but not the linked building names. Any ideas? code ======================================= <?php require_once 'dao/Room.php'; $dbconfig = parse_ini_file('dao/db_dataobject.ini', true); // Load Database Settings (note main PEAR class is loaded by Room.php) foreach ($dbconfig as $class => $values) { $options = &PEAR::getStaticProperty($class, 'options'); $options = $values; } $room = new DataObject_Room(); $room->building_ID = '2'; $room->find(); echo 'Room - Buildings:<br />'; while ($room->fetch()) { $room->getLink('building_ID','building','ID'); echo $room->number . ' - '. $building->name . '<br/>'; /* I also tried $room->getLink(); echo $room->number . ' - '.$room->_building->name.'<br />'; */ } ?> database.links.ini ============================ [room] building_ID = building:ID // I also tried [building] ID=room:building_ID which of course did not work either database.ini ============================ [building] ID = 129 entity_ID = 129 name = 130 [building__keys] ID = N [room] ID = 129 building_ID = 129 number = 130 [room__keys] ID = N db_dataobject.ini =========================================== [DB_DataObject] database = mysql://username:password@localhost/db_name schema_location = C:\....\dao class_location = C:\....\dao require_prefix = ExampleApps/DataObject class_prefix = DataObject_ debug = 0 debug_ignore_updates = false dont_die = false --------------------------------- Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more.

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