Home arrow PHP arrow A Persistent Class in Action

A Persistent Class in Action

If youíre a PHP developer who wants to learn how to create objects that can maintain their state through different HTTP requests, either by using cookies, plain text files or MySQL database tables, then donít look any further because youíve come to the right place. Welcome to the last part of a six-part series on building persistent objects in PHP 5. This tutorial series introduces the key concepts that surround the creation of persistent objects, and complements the corresponding theory with copious code samples.

TABLE OF CONTENTS:
  1. A Persistent Class in Action
  2. Review: creating a database-driven persistent class
  3. Spawning a persistent object from the User class
  4. Retrieving properties of a persistent object on a different web page
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
September 30, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

And now that you know what to expect from this set of articles, it's time to review the topics that were discussed in the last one. In that part of the series I built a simple example class in PHP 5, which was able to save its properties, along with the values assigned to them, to a MySQL table.

All of the database operations required to save the example class's properties were delegated to an instance of a basic MySQL abstraction class. This abstraction class was injected (or aggregated) into the constructor of the persistent class.

Of course, the best part of defining a class like this is that it's possible to retrieve its properties at a later time on a different PHP file, thus building a software entity that can persist (at least partially) across a number of web pages.

However, the best way to understand how the two classes referenced above can interact with each other is by means of a concrete example. Therefore, in this last installment of the series I'm going to set up that example for you. Doing so will wrap up this introductory guide to building persistent objects in PHP 5.

Ready to tackle the final chapter of this hopefully instructive journey? Then, let's get started right now!



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