Welcome Guest, Not a member yet? Register   Sign In
Model Philosophy
#1

[eluser]logan2z[/eluser]
I've come to CI from a Rails background so I have a pre-conceived notion of how models are used in an MVC framework. But CI seems to view models somewhat differently from Rails and I'm struggling a bit philosophically with the differences. In particular, I was expecting the CI model to be more OO in nature and provide a way to instantiate a Model object from form data a la Rails. CI, on the other hand, seems to view Models as simply a way to talk to the db and not really a way to encapsulate model data (someone correct me if I'm way off base here). Anyway, I decided to create my own BaseModel class that extends the CI Model class and provides a constructor that populates the model class's 'attributes' from form data. That seems to work reasonably well, but what it means is that I am handing model objects to my view from the controller, rather than extracting form data in the controller and making it available to the view. I haven't seen much CI code up to this point, but none of the examples I've seen in the docs ever seem to do this. Is doing this sort of thing against the spirit of CI, or is this a pretty common way of doing things in the CI world?


Messages In This Thread
Model Philosophy - by El Forum - 10-23-2009, 10:10 AM
Model Philosophy - by El Forum - 10-23-2009, 10:18 AM
Model Philosophy - by El Forum - 10-23-2009, 10:30 AM
Model Philosophy - by El Forum - 10-23-2009, 11:01 AM
Model Philosophy - by El Forum - 10-23-2009, 12:58 PM
Model Philosophy - by El Forum - 10-23-2009, 02:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB