Welcome Guest, Not a member yet? Register   Sign In
Oobleck - A patterned approach to dealing with forms and databases in CI controllers
#3

[eluser]webthink[/eluser]
Hi xwero,
You're right. The biggest challenge was coming up with a way to handle cases where fields are not mapped identically between form and table. That's why I implemented the dynamically named functions to go in your controller: set_additional_fields[TABLE_NAME]_[ACTION]() and _process_to_db_[FIELD_NAME]() the former sets any fields that aren't present in the form on a per table basis and the latter allows you to process individual fields prior to insert/update. If you look at the example for the user registration form you can see that I'm updating two tables and for each I'm adding a additional fields for each table and doing some pass through processing on some individual fields.
If you can think of a non-standard example where this might not be enough I'd like to know because I'd like to build in flexibility where ever possible.
If you mean how would I deal with controllers where there are multiple forms each with a unique set of fields that's something I had planned on building support for. I'll let you know when I've got something.

Thanks


Messages In This Thread
Oobleck - A patterned approach to dealing with forms and databases in CI controllers - by El Forum - 02-25-2008, 03:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB