Re: DB_DataObject_FormBuilder and many-many links

From: Date: Tue, 25 May 2004 18:29:21 +0000
Subject: Re: DB_DataObject_FormBuilder and many-many links
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29658@lists.php.net to get a copy of this message
Norbert Mocsnik wrote:
Hello Justin, (cc-d to Markus, sure he'd like to see it) It's on my hard drive. :) I didn't post it yet since it still needs some work. However, feel free to browse/improve the code, which is NOT stable yet - however it works well. Search for 'autocrosslinks' in both generateForm() and processForm(). modified FormBuilder (NOT the latest one from the CVS.. copy my new stuff from generateForm() and processForm() and paste into your actual FormBuilder version) http://norbert.mocsnik.hu/crosslink-triplelink-FormBuilder.phps usage example: http://norbert.mocsnik.hu/crosslink-triplelink-example.phps if you do it well, you don't have to deal with forms like this manually: http://norbert.mocsnik.hu/crosslink-triplelink-example.png If you have some free time check out triplelinks also hehe.. :) Joining 3 tables, storing in +1 table.. - for this functionality getSelectOptions() has been split into two functions - B.C. O.K. of course! Regards, Norbert Justin Patrin wrote:
I seem to remember someone posting to one of these lists about a many-many link addition made to the FormBuilder class. Does anyone recall this or remember where the code was?
Yep, this is exactly what I'm looking for. Some comments (my opinions, of course): I also think the options should also be in the DO, not in formbuilder. Perhaps this should be _crossLinks? No need for the auto IMHO. 'crosslinktable' should really be only 'table'. This should also give the full table name, not just the "to" table as naming conventions are not always the same. Ex: 'dvdsSubtitles' or 'dvds_link_subtitles'. 'masterfield' *should* be auto-findable just fine. Of course, it will require checking all of the links entries for the crosslink table. Small price to pay for less config, though. 'detailfield' should also be auto-findable. I would suggest choosing the first link field other than the masterfield. For auto-finding these two fields, I would suggest making the config options optional but still supported for extreme (or speed consious) cases. 'masterfield' could be 'from_field'. 'detailfield' could be 'to_field'. With autoTripleLinks, the table should be an option (as outlined above). The fields should be auto-findable, as before. The linkedtable1 and 2 fields shouldn't be needed as the links.ini gives these values. 'masterfield' => 'from_field' 'detailfield1' => 'to_field_1' 'detailfield2' => 'to_field_2' -- paperCrane <Justin Patrin>

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