HomePHP Method Chaining: Adding More Selecting Methods to the CodeIgniter Library
Method Chaining: Adding More Selecting Methods to the CodeIgniter Library
In this ninth part of an 11-part series on method chaining, I will add three new chainable methods to the custom CodeIgniter model class we built in previous parts. You should find this a straightforward process, especially if you have a decent background in this framework’s database class.
While it’s not going to change forever the way that PHP developers build their web applications, method chaining is a solid programming approach that permits them to build classes that have highly compact and modular interfaces.
So, if you’re always looking for new ways to improve your existing development skills and want to learn how to incorporate chainable methods into your PHP programs, then you should read this series of articles. In it you’ll find a guide that will show you how to accomplish this in a truly friendly fashion.
However, if you’ve been a patient reader and have already read the previous installments, then you now have a solid background in creating chainable methods with PHP 5. In those tutorials I not only explained how to implement this kind of method, but how to use them for developing a custom model library for CodeIgniter.
Now, speaking more specifically, in the preceding article I added a couple of chainable methods to the aforementioned CodeIgniter model for building the SELECT and SELECT MAX parts of a SQL query. They expanded the model’s current functionality.
Nonetheless, it’s fair to say that there is still plenty of room for expanding the capabilities of the model. Therefore, in the course of this ninth part of the series I’m going to code a couple of additional chainable methods to it that will be tasked with building the SELECT MIN, SELECT SUM and SELECT AVG parts of a SELECT SQL statement respectively.
So, want to see how these brand new methods will be coded? Then, get rid of the preliminaries and start reading right now!