Tom Chiverton wrote:
On Friday 09 Mar 2007, Sammy Larbi wrote:
Can't tell if that is facetious or not =) But, yeah, that's what I've
been working on lately - change a DB column and change is reflected
throughout application. But not the other way around (I've thought
about doing that too, believe it or not - just not sure of its value,
since I tend to work the other way)
What if I modified your form's POST ? Can I now alter anything I like then ?
Tom,
Not sure exactly what you mean. I'll describe in better detail what I
meant, and then await your reply.
Right now, I have it such that there is (for example) a Demographic
object that relates to a Client. So, in my database, I have a
Demographic table and a Client table. I create a couple of components
that extend some base components I have (without any other code), and
then I've got a form to insert a new client, update an existing one,
delete an existing one, a listing of them all, plus a bunch of methods
to allow me to manipulate it (very similar to Ruby on Rails, if you've
used it). I've got the same stuff for the demographics. In code, I let
the Client know that it should auto-load some columns from the
associated Demographic row when it is created, because I want those to
be available to me to show with my Client object. I do similar stuff
for Demographic. But, Demographic has a bunch of foreign keys to things
like "Valid Races" and "Valid Age Ranges, " so rather than having a text
field to put an int for the key, I tell it to load a select which should
be populated from the respective tables (eventually, I may automate a
lot of that too).
What I was saying about "the other way around" is basically, instead of
relying solely on the db, allow myself to define properties in my
objects, and then if they don't exist in the DB, "automagically" create
those respective columns in the DB/table. So, the form wouldn't do it,
as that is generated based on the object, but the object definition
might effect changes in the database schema.
About modifying "anything you like" -- I'm not sure what you mean by
that, but yes, if you want to you can certainly do that. In the
controller you could modify the form structure and its keys (not that
that may be a good idea), but in the model, it extracts from the form
any keys which it has itself, and then you could define a method,
beforeSave() where you could do calcualtions if you need.
Does any of that hit on what you meant? =)
-Sam
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]