DataObject extension: getCrossLink()

From: Date: Tue, 03 Dec 2002 14:27:24 +0000
Subject: DataObject extension: getCrossLink()
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-11321@lists.php.net to get a copy of this message
Hi all, I'm a really satisfied user of the DataObject module, and I think it works great. It's a real relief not having to (re)write all those get() and set() methods for each object you want to use, and when you change you database design a little (ie, adding a column). However, there was one shortcoming which seemed easy to resolve to me: the DataObject lacked a simple getCrossLink method to fetch DataObjects related in a n-to-m way with the current DataObject. I know the PEAR manual states that (most) join queries are too complex to get them into a generic method, and only supplies a getLink() and getLinks() method to fetch 1-to-n related objects (which works great btw). In my current project I'm using the n-to-m relationship a lot, for example with images related to products, productsubgroups and productgroups. So, I've writted a simple method to fetch these objects for me. I've mailed about it with Alan Knowles, and he said he was interested in seeing my solution. So, here it is, for all of you to review, comment and maybe even use. Stijn

« previous php.pear.dev (#11321) next »