Can a model contains business validation operations or low level data handling stuff ? - 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: Can a model contains business validation operations or low level data handling stuff ? (/showthread.php?tid=41620) |
Can a model contains business validation operations or low level data handling stuff ? - El Forum - 05-12-2011 [eluser]Rushino[/eluser] Hello, I know model is for data management from a bd (for insert, update, select, etc.) but can a model also contains low level methods ? Example: I have an insert_entry(...) from an user model but that should only insert data to the DB. I would'nt encrypt the password in this method.. i may want a method that is called create_user instead that do this job and do some others stuff such send an email. Does that go in the model or that should go in a library? Thanks. Can a model contains business validation operations or low level data handling stuff ? - El Forum - 05-12-2011 [eluser]toopay[/eluser] I prefer to keep "single responsibility principle". A class should have one, and only one, reason to change. Can a model contains business validation operations or low level data handling stuff ? - El Forum - 05-12-2011 [eluser]Rushino[/eluser] What you mean ? Can a model contains business validation operations or low level data handling stuff ? - El Forum - 05-12-2011 [eluser]toopay[/eluser] [quote author="Rushino" date="1305228224"]... can a model also contains low level methods ?[/quote] That will break above principle, but that my own rules ;-) Can a model contains business validation operations or low level data handling stuff ? - El Forum - 05-12-2011 [eluser]Rushino[/eluser] nah its okay i made a library for it.. so i am on the good path. Thanks! |