Re: FormBuilder help
| From: | Patrick Paul | Date: | Thu, 25 May 2006 18:23:25 +0000 |
| Subject: | Re: FormBuilder help | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24159@lists.php.net to get a copy of this message | ||
Justin Patrin wrote:
On 5/25/06, Patrick Paul <ppaul_apache@yahoo.ca> wrote:So I guess my question is the following : is there any proper way to make DO understand that there is no primary key so that it won't give them a "special treatment" that it incompatible with my code ? If not, how could I work around this limitation, or maybe modify DO to my needs ? (preferably without creating a useless auto incremented PK + UNIQUE index on my 2 fields) Thank you, Patrick P.S. I am now receiving messages from the mailing list, so you don't need to cc anymore :-)Thank you Justin, everything is working great.Oh, and don't do this:$description->keys('id');Give your description table its own auto_inc PK.I'm guessing this is because Data_Object does not support multi-field keys ? Is there any way to go around this other than adding an auto_inc PK to tables ? (I have 70 tables). Is it really that bad to do a "$description->keys('id');" ?There is no 'id' field in this table, so this is incorrect.
Thank you, Patrick Justin Patrin wrote:On 5/24/06, Patrick Paul <ppaul_apache@yahoo.ca> wrote:Yes, as I said: $description->cities_id = $city->cities_id; Oh, and don't do this:receivingFirst of all thank you for you quick response. I just subsribed to the mailing list a few hours ago and I'many mails and I don't know why. Anyways, regarding the problem at hand, I did what you told me and it works to create a new city in the cities table. However, the id used for the description is not set right and I'm not sure I understand what you meant by "Make sure to set the city ID in the description DO before you process it, though." What I want is the citites_id that has just been created for the cities table.Give your description table its own auto_inc PK.$description->keys('id');But then you negate all of that here. You're using a description-only form from my last comment to here. That's not what you want. Instead of using $form, use $combinedForm. Then, to process, call $form->process with *both* of the formBuilder instances. First the city one, then the description one. Make sure to set the city ID in the description DO before you process it, though.Thanks again, Patrick Justin Patrin wrote:*?>* Any help would be welcome. Thank you,