I'm not sure what you mean by "baking" the model - bake is just a
command line application to make model/view/controller stubs (although
stubs doesn't give them much justice, they are very functional).  Even
a "complete" model file will not specify the database fields, except
where needed for validation.

But anyway.  So you have your XML uploaded (and related Quicktime
files), you've parsed the XML data, and now you want to save it.
Firstly, do you really need the form before saving?  If it is just for
manual validation before the data is saved to the database, is this
really needed unless there is an error?

I would suggest that your parsing converts the XML into associative
arrays suitable for saving as model data.  Yes, this does mean that you
need to know the database field names in your parsing/conversion code,
but this isn't really that bad (you need to know the XML field/element
names too).  Rapid development is the key here, rather than over
architecting parts that aren't really likely to change.  Once you've
parsed the XML into an associative array of model data, just save it
and rely on the Model's standard validation.  If this save fails,
display an edit form just like any other edit() action, for manual
verification.

Of course, this is assuming your XML inserts only a single model row.
If it has a number of rows, then it would probably be best to parse and
validate the data, and display some kind of summary validation page to
the user.  If they continue, the file is again parsed, but the models
are saved.  This is the approach I'm using for uploading a CSV of user
data, where if there are problems it is easier for the user to
re-upload the file than to use a form to fix each row.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to