![]() |
Am I using this base model correctly? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Am I using this base model correctly? (/showthread.php?tid=42691) |
Am I using this base model correctly? - El Forum - 06-15-2011 [eluser]snifty[/eluser] I'm still trying to wrap my head around OOP in PHP, it would be great if someone could cluebat me if I'm totally off base here: I found a really nice base model which takes care of the basic CRUD functionality in models, this one: https://github.com/jamierumbelow/codeigniter-base-model Using that I've been able to remove a lot of my model code. But the docs are pretty minimal, so I'm not sure how to go about overriding one of the methods -- say, for instance, I want to customize the insert method in my application/models/foo.php: Code: class Phrase_model extends MY_Model { // MY_Model is the one from the link That seems to work -- am I on the right track? Thanks! Am I using this base model correctly? - El Forum - 06-15-2011 [eluser]Eric Barnes[/eluser] Yes I find the way you did it the easiest. Especially when I go to view it later ![]() Another option could be to tie into the before_create part of that file. Am I using this base model correctly? - El Forum - 06-16-2011 [eluser]snifty[/eluser] Thanks Eric! And as long as I have your attention thanks for working on Codeigniter, it's awesome. ![]() |