Completing a Model for the CodeIgniter PHP Framework
(Page 1 of 4 )
One of the most remarkable features offered by the CodeIgniter PHP framework is its great flexibility, which lets web developers build custom libraries that contribute to extending the framework’s core functionality. In this group of articles you’ll learn how to create a generic model class for CI. The class will permit you to perform CRUD operations against a number of database tables in a truly painless fashion, without having to spend a long time coding numerous and complex models.
Of course, if you've been a patient reader and already went through all of the previous tutorials of this series, then by this time you’ll hopefully have a very clear idea of how to build a generic model class for CodeIgniter. In those articles I not only proceeded to define such a class, but progressively added several features to it, including capabilities for retrieving, saving and deleting database rows, as well as for validating data passed to the model.
Despite the fact that all of the features shown before are indeed very useful, the model class in its current state is still incomplete. It lacks methods that allow it to perform generic SQL statements, clean up its set of properties and so forth. Therefore, in this penultimate chapter of the series, I'm going to incorporate a few additional methods into the model class that will be tasked with executing these all of these specific operations.
It's time to get this generic model classy completed. Let’s do it right now!