Re: DB_DataObject_FormBuilder crossLinks

From: Date: Sun, 25 Jun 2006 00:23:10 +0000
Subject: Re: DB_DataObject_FormBuilder crossLinks
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24458@lists.php.net to get a copy of this message
On 6/24/06, Jay E. Taylor <jaytaylor@taylorproperties.com> wrote:
Hi, I am going to try and add you to to IM, but in case that doesn't pan out, hopefully you will get this message. I am trying to build a form with checkbox inputs that will get stored to a database, so I started by following this simplified example:
Well, a normal single checkbox input would be a boolean field.
http://www.go-pear.org/package/DB_DataObject_FormBuilder/docs/latest/apidoc/ DB_DataObject_FormBuilder/DB_DataObject_FormBuilder.html#var$crossLinks But now, when I do an insert, it deletes all previous user_group items from the database?
Ah, user_group does sound like a N-N/crossLink situation. It shouldn't be deleting all of your previous entries. Do you have a primary key set up for user_group? DB_DataObject requires a single column primary key field on each table in order to do many operations and FormBuilder relies on this. No, you can't have multi-column PKs. Read the archives and bug reports for DB_DO for discussion. It's not that it's not wanted, it just need to be properly implemented. By single column primary key I of course mean an auto-incremented field (assuming mysql).
This behaviour is very confusing to me. Output is here: http://pastebin.ca/70827
DELETE FROM usr_grp WHERE ( usr_grp.id = 3 )
Well, this looks fine, assuming that this group checkbox was unchecked. And I guess you have a PK.
INSERT INTO usr_grp () VALUES ()
That looks very odd, though. Are you sure you named your fields correctly? Is the links.ini correct? You're not setting the links backwards?
If you have any insight, I would REALLY appreciate it! I would also like to know if there is a simpler way to creata a 1-N relationship via DBDOFB?
1-N is just a normal foreign key or link. If you mean one form to link a bunch of records *back* to one record then you want a reverseLink.
Thanks! Best Regards, Jay Taylor jaytaylor@taylorproperties.com 650.575.0996
-- Justin Patrin

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