Welcome Guest, Not a member yet? Register   Sign In
Don't Repeat Yourself in CI doesn't exist
#16

[eluser]winter[/eluser]
[quote author="obiron2" date="1235504485"]@gh0st

In your example of the car, to produce this as DRY you would store a 'model' of the car properties and thier database locations in a model file.

Pull the car 'model' and use the fields to carry out the select and data return in your DB query and again to populate the fields in the view.

This way, when you change the properties of the car, you only have to change the 'model' and the DB query and view will change automatically.

Of course, you would still need to add the relevant fields to the relevant tables.

This technique is handy for building generic forms - I am working on one at the moment, if I ever get a chance to finish it, I will publlish it in the wiki

DRY is possible with CI, but somtimes you need to make one more lateral thought step.

obiron[/quote]

Sorry to butt in here, but that sounds really cool. If anyone has some working code examples or tutorials, I'd really enjoy seeing them.

Cheers!


Messages In This Thread
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 01:46 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 02:05 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 02:46 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 02:54 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 03:11 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 03:35 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 05:29 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 05:45 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 06:52 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 07:01 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 07:30 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 07:41 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 09:29 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-25-2009, 07:16 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-25-2009, 07:50 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 03-26-2009, 03:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB