Home arrow PHP arrow Completing a CodeIgniter Library with Method Chaining

Completing a CodeIgniter Library with Method Chaining

In this eleventh part of a 12-part series on method chaining, I will finish building the custom CodeIgniter library we've been working on by adding to it some very useful features. When we're done, the library will be able to autoload a specified model and validate input data.

TABLE OF CONTENTS:
  1. Completing a CodeIgniter Library with Method Chaining
  2. Adding more chainable methods to the abstract model class
  3. Autoloading models and validating incoming data
  4. The final version of the abstract model class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 1
December 02, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

True to form, method chaining is a powerful approach that lets programmers build compact and highly modular class interfaces. Of course, this methodology isnít a proprietary feature of a particular language, which means that it can be applied quite easily in PHP 5.

Thus, if youíre a PHP developer who wishes to expand your existing skills and learn how to create and implement chainable methods when using the object-oriented paradigm, then this series of articles might be the material that youíre looking for.

Naturally, if you already had the chance to read all of the articles that precede this one, then you now have a solid background in how to create chainable interfaces in PHP 5, and how to use them for building a custom model for the CodeIgniter framework.

Speaking more specifically, in the previous article I demonstrated how to expand the functionality of this model by coding a set of chainable methods. These were tasked with building several WHERE modifiers  for appending to a given query.

As youíll surely recall, the implementation of these methods was  a straightforward process, so itís time to mention the topics that will be covered in this penultimate chapter of the series. Thus, as the above title suggests, in the next few lines Iím going to finish developing this custom model for CodeIgniter by adding to it some methods that will perform crucial tasks, such as automatically loading classes required by the model and validating the data required for inserting and updating database records, and building error strings and creating other common query modifiers dynamically as well.

Now, itís the time to complete this abstract model. Letís get going!



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

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