logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: data object getLinks: msg#00533

Subject: Re: data object getLinks
I've not tried it, but in theory,

$object->getLinks()
$arr[] = $object->_linkedrow;
while($object->_linkedrow->fetch()) {
        $arr[] = $object->_linkedrow;
}

should get you the N items...

if not, I probably need to look at using the code in joinAdd to return an unfetched element on 1:N relations..

regards
Alan


Mitchell Perilstein wrote:
Hi all,

Hope this doesn't sound too strange.  Does getLinks() support MULTIPLE,
UNIQUE links to the same table?  That is, pointers to different
instances.

In my case I have a Reservation table which has columns for two trains
holding foriegn ids, which indexing a Train table.  (This represents a
2:N relation.  Since the 2 is fixed by the real world, I saw no point in
an M:N table when two columns would do it.)

CREATE TABLE tReservation (
  tTrain_id_1 smallint(6) NOT NULL default '0',
  tTrain_id_2 smallint(6) NOT NULL default '0',
   ...
);
CREATE TABLE tTrain (
  trainId smallint(6) NOT NULL auto_increment,
  ...
);

I have experimented with something like this in the links table

    [tReservation]
    tTrain_id_1  = tTrain:trainId
    tTrain_id_2  = tTrain:trainId

but it's not reliable.  getLinks() is working well in other parts of
this same system, but I wonder if I'm abusing it here.

Perhaps I need to override getLinks to explicitly do those two loads?

Thanks,


--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>