Re: DB_DataObject Automatic table linking issue
| From: | Alan Knowles | Date: | Fri, 25 Jul 2003 01:02:59 +0000 |
| Subject: | Re: DB_DataObject Automatic table linking issue | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-6807@lists.php.net to get a copy of this message | ||
Wade wrote:
Hi: I am using the DB_Dataobject package with great success. Thanks. I have an issue, however, with trying to use Auto Linking via a databasename.links.ini file. I see the Auto-generated linked objects (print_r($objects)) in my DB_DataObject class. I can see the field names and values of the associated AutoLinked tables in the debug output from print_r(). But I only get Nulls when I try to access the auto-linked fields like: $myDBObject->_tablename->someField. I've even tried $myDBObject->dataobjects_tablename->someField since that what they show up as in the debug output.it should be $myDBObject->_fieldname->fieldname have a look in more detail at the print_r($myDBObject) output it should show you where the child object is attached. I would also suggest you clone the object before getting links eg. while ($dbdo->fetch()) { $copy = $dbdo->__clone(); $copy->getLinks(); print_r($copy); echo $copy->_somefield->somefield } version 1.0.1 supports user defined names for get links eg. $copy->getLinks('link_%s'); //where %s is replaced with the column name of the link. Regards alan
Any ideas? (latest DB_DataObjects, PHP 4.3.1, mysql 4.0.13, Suse 8.2) Thanks, Wade. --------------------------------- Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software