HomePHP The Data Mapper Design Pattern: A Final Example
The Data Mapper Design Pattern: A Final Example
Welcome to the final part of a series on implementing the Data Mapper design pattern in PHP 5. This series teaches you the key concepts that surround the development of data mapper classes. It complements the corresponding theory with a decent variety of code samples.
And now that you've been introduced to the primary goal of this series, it’s time to review the topics that were discussed in the previous part. In the course of that tutorial I finished building a basic data mapper class, which in this particular case was responsible for mapping user domain objects to their associated MySQL table via a clean interface.
As one would expect from an appropriate implementation of a data mapper class, the one mentioned above was provided with the ability to perform CRUD operations on the target database table, while keeping the referenced domain objects entirely ignorant of their persistent storage mechanism.
Although describing the role of a data mapper is a fun and instructive process, the best way to understand its actual functionality is by seeing some illustrative examples. Bearing that idea in mind, in this last installment of the series I’m going to code for you a hands-on example that will show you how to utilize the user mapper class built previously to fetch, insert and delete a few user domain objects.
The experience will be fairly educational, trust me. Now, click on the link below and start reading right now!