where should I place the calls to my class? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: where should I place the calls to my class? (/showthread.php?tid=39961) |
where should I place the calls to my class? - El Forum - 03-25-2011 [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-guide/general/creating_libraries.html) I should make the calls from the controller, but acccording to this tutorial (http://php-html.net/tutorials/model-view-controller-in-php/) I should make the calls from the model. Thanks in advance for your help. PD: English is not my natural language... where should I place the calls to my class? - El Forum - 03-25-2011 [eluser]InsiteFX[/eluser] If it does not pertain to the database put it in the controller Models should only handle database interactions. InsiteFX where should I place the calls to my class? - El Forum - 03-25-2011 [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. where should I place the calls to my class? - El Forum - 03-26-2011 [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. where should I place the calls to my class? - El Forum - 03-26-2011 [eluser]Atharva[/eluser] I don't see anything wrong to put call to the class in controller. where should I place the calls to my class? - El Forum - 03-26-2011 [eluser]coffak[/eluser] Ok thanks for the replies! |