Re: Formbuilder

From: Date: Wed, 07 Sep 2005 16:30:17 +0000
Subject: Re: Formbuilder
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20844@lists.php.net to get a copy of this message
On 9/7/05, thefloz <thefloz2001@yahoo.fr> wrote: > Hello all, > > Here is my problem : > > I've two table : "Type" and "Year" (annee in French) and a many to > many > relation between > then with properties(so I've a third table called "Date"). > > I want that a person could add a relation between a certain year and a > selection of type and edit the relation properties. > So I used formbuilder to generate a form for the table Date, I ask it to > show the primary key and I make the function prepareLinkedDataObject to > select types and the date I want. > > But formbuilder make an update : (I've activated the debugLevel) > > UPDATE date SET [... properties of the relation ...] WHERE > date.id_annee = 2006 AND date.id_type = 2 > Do you have a Primary Key set up for your crossLink table? If you don't have a single-column primary key, DB_DataObject (and hence FormBuilder) won't be able to figure out updates and inserts "correctly". > And there is no record with this "where condition" precisely because I > want it to create. > > I guess it's because I set hidePrimaryKey to false. > > I also tested with the Year object and use crossLinks and > crossLinkExtraFields but it seems that extra field are of the linked > table and not of the relation table. > I'm not sure about the rest of your problems but if you set up your crossLink and crossLinkExtraFields correctly you can edit fields in the crossLink (i.e. the many-many table) just fine. You can see an example in action here (See the "Songs" section): http://pear.reversefold.com/example/?table=movie&record=18 Source is here: http://pear.reversefold.com/example/source/example.tgz -- Justin Patrin

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