Home arrow PHP arrow Adding Ordering and Grouping Clauses to the CodeIgniter Library with Method Chaining

Adding Ordering and Grouping Clauses to the CodeIgniter Library with Method Chaining

Welcome to the tenth installment of a series on method chaining in PHP 5. Comprised of twelve tutorials, this series teaches you the key concepts that surround the implementation of chainable methods within PHP classes, and shows how to put them to work to create a custom library for the popular CodeIgniter framework.

  1. Adding Ordering and Grouping Clauses to the CodeIgniter Library with Method Chaining
  2. Creating the JOIN, ORDER BY and GROUP parts of a query
  3. Conditional queries: adding WHERE modifiers to a SELECt statement
  4. The custom model class's full source code
By: Alejandro Gervasio
Rating: starstarstarstarstar / 1
November 25, 2009

print this article



And now that you know what to expect from this series of articles, itís time to refresh the topics that were discussed in the last one. In that part of the series I explained how to add some chainable methods to the already familiar ďAbstractModelĒ class, which was a pretty useful add-on for CodeIgniter.

Expressed in simple terms, the methods that I implemented within the class were responsible for creating the SELECT MIN, SELECT SUM and SELECT AVG parts of a SELECT SQL statement respectively. However, by sticking to the method chaining approach, itís also feasible to create methods that build other portions of a query, such as the JOIN, ORDER BY, GROUP BY, LIKE and NOT LIKE modifiers, and a few others as well.

So, with that premise in mind, in this tenth chapter of the series, Iím going to code a few more methods, (also chainable, of course) that will be charged with performing the aforementioned tasks in a simple manner.

Now, letís leave the preliminaries behind and continue expanding the functionality of the CodeIgniter custom library by means of the method chaining approach. Letís go!

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: