Re: DBDO links question
| From: | Alan Knowles | Date: | Fri, 07 Nov 2003 10:12:25 +0000 |
| Subject: | Re: DBDO links question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8822@lists.php.net to get a copy of this message | ||
Joe Stump wrote:
Hi all, I'm using DBDO to do linking between tables and I have a few questions: 1.) Can I rename my links? Times may arise where a table's column is linked to more than one other table (for instance userID is linked to userID in sessions and userID in blog).You can use all the arguments in getLink to specify the full link you want to use.. $object = $this->getLink('thisColumnName','otherTable','otherTableColumnName')
2.) Is 1:N and M:N a possibility? The docs would indicate that it's not, but I know how sometimes docs and code are sometimes out of sync. "It assumes the relationships are non-primary id to primary id, as the example below shows, the person.owner is linked to grp.id. This indicates that running getLinks() on the person object, will fetch a single bit of data"getLink really needs updating to have an alternative sytnax: $this->getLink(array( 'from' => 'thisColumnName', 'to' => 'otherTable.otherColumn' 'dontFetch' => true )); (by doing a is_array() on $row.. ) - but I havent had time to look at this..
3.) Is there support for compound keys (in links or otherwise)?not really.. - if you are getting this complex it's probably worth writing a method for it specifically in the generated class. Regards Alan
Thanks! --Joe -- Joe Stump <joe@joestump.net> http://www.joestump.net "Label makers are proof God wants Sys Admins to be happy."