Home arrow PHP arrow Using Visitor Objects with MySQL Data Sets in PHP 5

Using Visitor Objects with MySQL Data Sets in PHP 5

If you’re looking for brand new material to help you expand your background in using design patterns with PHP 5, then hopefully this article will suit your needs. Welcome to the final installment of the series “Introducing Visitor Objects in PHP 5.” Composed of three chapters, this series walks you through the key points of creating and using visitor objects with PHP 5, and teaches you how to use them in the context of real-world applications.

  1. Using Visitor Objects with MySQL Data Sets in PHP 5
  2. Visiting database result sets: establishing an interaction between visitors and MySQL
  3. Revealing the anatomy of a visitor class: creating visitor objects
  4. Completing the round trip: defining the structure of a pagination class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 9
August 16, 2006

print this article




As you hopefully learned over the course of the two previous articles, building visitor classes is not only a fairly comprehensive process that can be done without much trouble, but it's also an exciting  experience, which indeed deserves an in-depth look. That's why in the first article, aside from introducing the fundamentals of visitor objects, I showed you an introductory example, which demonstrated how a specific object, in this case called "the visited one" can accept another (the visitor) to allow the inspection of its properties.

In addition to the introductory example that I mentioned before, in the second tutorial I went through the development of a slightly more complex example. It illustrated how a highly generic "User" class could be inspected by its corresponding visitor, which resulted in the ability to access of all its visible properties without having to specifically use its own methods.

So far, implementing visitor objects with PHP is indeed a educational process, which helps to extend even more the boundaries of the vast arena of pattern-based programming. Based on this premise, in the course of this last article, I'll expand the application of the visitor pattern by developing a slightly more realistic example. It will show you how to use visitors objects to establish a direct relationship between a MySQL processing class and a pagination mechanism.

In return for all the code samples that you'll learn in this tutorial, you'll be equipped with a better grounding, not only with reference to this pattern in particular, but also regarding the main pillars of pattern-based web development. Thus, I think it's time to get rid of the preliminaries, and continue learning more about using visitor objects with PHP 5. Let's move on!

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