Home arrow PHP arrow Expanding a Custom CodeIgniter Library with Method Chaining

Expanding a Custom CodeIgniter Library with Method Chaining

Welcome to the eighth installment of a series on method chaining in PHP 5. With numerous code samples, this series shows you how to define chainable methods within your own PHP classes. Best of all, it teaches you how to implement this powerful programming method in a real-world case: developing an abstract model for the CodeIgniter framework.

  1. Expanding a Custom CodeIgniter Library with Method Chaining
  2. Review: the delete() method
  3. The chainable select() and select_max() methods
  4. The AbstractModel class's full source code
By: Alejandro Gervasio
Rating: starstarstarstarstar / 1
November 16, 2009

print this article



Naturally, if you already read the preceding article of the series, at this point you have a clearer idea of how to apply the method chaining approach to building a customized model class for CodeIgniter. In that tutorial I started to create such a class. It had the ability to fetch and insert/update the records of an associated database table through a few methods, some of which were chainable.

However, as you might have guessed, this CodeIgniter class has a rather limited functionality in its current state. Therefore, in this tutorial of the series Iím going to add more methods to it, which will permit it to delete database rows, as well as build different portions of SELECT statements. And guess what? These last methods will be chainable too!

Now, itís time to begin coding the methods for this custom CodeIgniter library. Letís jump in!

>>> 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: