News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Developer.com:
PHP 5 OOP - Delegation and Custom Exceptions
May 23, 2006 @ 12:06:36

Developer.com has posted the next part in their series covering object oriented programming in PHP5, this time focusing on using delegation to enhance the functionality of their prexisting DBQuery class.

At present our DBQuery object simply mimics (all be it - rather simply) a stored procedure. Once executed a result resource is returned which you must store and pass the MySqlDB object if you wish to use functions such as num_rows() or fetch_row() on the result set. Would it not be nice if the DBQuery object were able to implement the functions which the MySqlDB object implements; that are designed to work on the result of an executed query?

They explain each step of the way, giving you the code you'll need to attach to the current working script, making this delegation possible. They look briefly at tpye hinting and simple exception handling in the script before hitting you with a full-blown Exception handler class to improve your script's reliability.

0 comments voice your opinion now!
php5 oop delegation custom exceptions part3 tutorial php5 oop delegation custom exceptions part3 tutorial


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: An Introduction to the Art of Unit Testing in PHP

AnyExample.com: Making XML/XSLT driven site using PHP

WorkingSoftware.com.au: Configuring PHP4 and PHP5 to run concurrently on FreeBSD

Abou Kone's Blog: Set up JSON action output in CakePHP 1.3

Antony Dovgal's Blog: 5.3 snapshots are avilable


Community Events





Don't see your event here?
Let us know!


community release refactor interview developer laravel framework testing unittest symfony2 code experience opinion install language series threedevsandamaybe list podcast introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework