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.

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
   

PHP ARTICLES

- 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...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap

Dev Shed Tutorial Topics: