where should I place the calls to my class? |
[eluser]coffak[/eluser]
Hello everybody, I'm new in codeigniter and MVC pattern. I've been reading about MVC theory and codeIgniter and I am not sure where should I place the calls to my class. Should I place it in the model or in the controller? According to the user guide (http://ellislab.com/codeigniter/user-gui...aries.html) I should make the calls from the controller, but acccording to this tutorial (http://php-html.net/tutorials/model-view...er-in-php/) I should make the calls from the model. Thanks in advance for your help. PD: English is not my natural language...
[eluser]InsiteFX[/eluser]
If it does not pertain to the database put it in the controller Models should only handle database interactions. InsiteFX
[eluser]Developer13[/eluser]
[quote author="InsiteFX" date="1301126414"]Models should only handle database interactions.[/quote] False. Models contain business / domain logic. They are not merely restricted to database access.
[eluser]coffak[/eluser]
I agree with the tutorial, I think that the model can handle business logic and database operations, and my class will only contain properties... but I am not sure if it's ok to call the class from the controller, and that's what i'm trying to know.
[eluser]Atharva[/eluser]
I don't see anything wrong to put call to the class in controller.
|
Welcome Guest, Not a member yet? Register Sign In |