Re: DataObject: getLink

From: Date: Sat, 09 Aug 2003 02:25:54 +0000
Subject: Re: DataObject: getLink
References: 1 2  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-7133@lists.php.net to get a copy of this message
Maybe there is a problem in DataObject since I have to use an older version of it (0.19). I Cannot update because my web hoster only provides a version of php lower than 4.3 and PEAR is not even installed on the server. I have to manage using PEAR on that server myself. Have reduced the dependency in CVS - 1.1 should be OK with php4.1
Does anybody know if there was a problem with getLink() in version 0.19 of DataObject? While debugging, I found a weird statement on line 220 of DataObject.php in methode get():
        $this->$k = $v;
Variable variables :) - the secret power of PHP.... $k = "fred"; $this->$k = "xxx"; is the same as $this->fred = "xxx"
Also the statement on line 221 seems to be strange:
        return $this->find(1);
find(1) - should be find(true), but essentially this finds and does a single fetch() Regards Alan
Any ideas? -- Cheers! Marco
Also, check that your links.ini file has an entry like this: [tb_C] id_A = tb_A:id_A id_B = tb_B:id_B Andy
Hello I have 3 tables that build together a m:n relation. Table tb_A has a filed (integer) called id_A Table tb_B has a filed (integer) called id_B Table tb_C has a filed (integer) called id_C and the keys from table
A     (id_A) and table B (id_B)
My (test-) code looks as follows: $tb_A = new DataObject_A(); $tb_A->id_A = 5; $content->find(); while ($content->fetch()) { $c = $tb_A->getLink('id_A', 'tb_c', 'id_A'); $str = "id_A: " .
          $tb_a->id_A .
          " references in tb_C id_B: " .
          $c->id_B .
          "<br>";
echo $str; } This code does not work as expected. The return from $tb_A->getLink is false. According to the manual, the while-statement should be: while ($content->find()) { ... but this results in an endless loop. Can anybody tell me what I am doing wrong, please. I would also be
glad
the get tips how to process such a m:n relation effectively by using DataObject. Thanks a lot! -- Cheers! Marco -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


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