Welcome Guest, Not a member yet? Register   Sign In
How useful is the codeigniter model class?
#1

[eluser]Ryan Zec[/eluser]
I just just wonder what the idea is behind the model class in the code igniter. Know i don't know to what extend other framework like phpCake, Ruby on Rails, Symfony, etc... go but i am also 100% sure that at a minimum the base model class(the one provide by the framework) provides functionality to get, insert and update data automatically and that is something that the user does not have to manually create themselfs. It seems like the base model class from codeigniter provide nothing is functionality. I also believe bigger framework like Ruby on Rails also provide additional functionality like server side validation, form creation, etc... What exactly is the idea behind the codeigniter's Model class and what functionality does it provide?
#2

[eluser]xwero[/eluser]
The model is a part of the MVC pattern which splits up you code into eas[y|ier] to maintain files. The models are the files where you store your data fetching and manipulating methods. The model class shouldn't work for a specific datatype like a database, xml or others so the base model is a sort of dummy class.

Because databases are the most common way to store data a functionality is added to connect with a database, the third parameter of the load->model method. The rest of the database functionality is split off in the database library. Which makes the models very flexible classes.

The database functionality you mention from symfony comes from propel and not from the framework itself. So if you add propel to your CI application you can do the same thing.
#3

[eluser]jamesf[/eluser]
Came across this extended model just the other day:

Extended Model Class

Not used it myself but it seems pretty useful




Theme © iAndrew 2016 - Forum software by © MyBB