Re: DB_DataObjects getLinks() bug?

From: Date: Fri, 08 Jul 2005 19:59:32 +0000
Subject: Re: DB_DataObjects getLinks() bug?
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19922@lists.php.net to get a copy of this message
On 7/8/05, Mark Petersen <markp@cherryone.com> wrote: > Justin, > > Thanks, but I must be doing something wrong... > > $warrior->find(); > while ($warrior->fetch()) { > print_r($warrior); > $warriorItems =& $warrior->getLink('warriorID'); Is warriorID the name of the field which links to another table? Also, you're naming this wrriorItems which means to me that you're expecting multiple records. You only get one record back from a link. > print_r($warriorItems); > } > > I get different warriors (as expected), but I get the same warriorItems > for both, while they both have a single unique item. > > > Justin Patrin wrote: > > > > As I always suggest: don't use getLinks(). Use getLink to get the > > specific link(s) you need. > > $linked =& $do->getLink('field'); > > > > > On 7/8/05, Mark Petersen <markp@cherryone.com> wrote: > > > >>When I some something like this: > >> > >>$warrior = new DataObjects_warrior_items; > >> > >>//Set Items for logged in warrior > >>$warrior->warriorID = $auth->getAuthData('id'); > >> > >>//find items > >>$warrior->find(); > >>while ($warrior->fetch()) { > >> $warrior->getLinks(); > >> > >>//print object > >> print_r($warrior); > >>} > >> > >>While the record updates appropriately when fetched, I only get the > >>links for the first record fetched. The database structure is as below: > >> > >>warrior > >> id > >> name > >> password > >> > >>warriorItems > >> itemID > >> warriorID > >> itemDescription > >> > >>warriors.links.ini > >>[warriorItems] > >> warriorID = warrior:id > >> > >> > >>Is there some command I need to remove the old links? I want to keep > >>the records I've already found of course, so I can't create a new > >>object. I guess I'll try something like this after the e-mail: > >>$warrior_temp = $warrior; > >>$warrior_temp->getLinks(); > >>print_r($warrior_temp); > >> > >>I wouldn't think that should be necessary though... possibly a bug? > >>When I fetch the next record I assume it would drop the old links. > >> > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Justin Patrin

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