Let's see if I can explain this better. I have the models setup correctly or so I think - new to all of this.
But I am getting lots of information posted from an external source so let's say field1, field2, field3, etc. etc. Fields 1-10 are customer information Fields 11-15 are product information Fields 16-20 are order information I need a script the can accepted the above fields, but the catch is for me to check to see if the customer exists, if not add it. Then check to see if the product exists, if not add it, then the same with the order. I don't understand how the current magic save stuff works - because it is all hidden from me. I need to see it working to understand it, but most examples just say use it. I am not using it the typical way so without understanding it, I am struggling to create the script to accept the posted information. Does that help or hurt? Chad On Thu, Dec 25, 2008 at 3:02 PM, Webweave <[email protected]> wrote: > > So are you saying you're getting data posted to you somehow that isn't > related to the tables you outlined? > > I'm not clear on whet you mean by "I can't control the name of the > fields coming in", but it sounds like you have the basic idea. > > Cake should handle the magic for you as long as you build the table > structure, model and relationships properly. > > All you need to do is build the Model structure into $this->data, and > do a saveAll (or save for each bit you are interested in). There are > lots of examples on how to do this floating around. > > On Dec 23, 8:11 am, "Chad Casselman" <[email protected]> wrote: > > Very new to cakePHP and of course the first thing I try doesn't follow > the > > model. > > > > I am trying to create a script which takes a lot of post variables (from > > 1shoppingcart exactly) and then puts them in the corresponding values in > my > > database design. > > > > Let's say my database is: > > customers > > customers_products > > products > > > > I haven't figured out exactly how to do the associations but that is not > my > > hang up right now. > > > > I can't control the name of the fields coming in, but I need for the > > save/post to go through the data and put the customer info into the > customer > > table (always new inserts), then go through the product information > (unknown > > count) (product1name, product2name, etc) and put them in the product > table > > (record of source) if they do not exist and then connect the customer to > the > > products that they ordered. > > > > I am completely stumped on how to even tackle processing form information > > that was not generated by cake. > > > > Chad > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
