Re: DB_DataObjects getLinks() bug?
| From: | Mark Petersen | Date: | Fri, 08 Jul 2005 19:44:25 +0000 |
| Subject: | Re: DB_DataObjects getLinks() bug? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19921@lists.php.net to get a copy of this message | ||
Justin,
Thanks, but I must be doing something wrong...
$warrior->find();
while ($warrior->fetch()) {
print_r($warrior);
$warriorItems =& $warrior->getLink('warriorID');
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.
markp
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.