HomePHP Lazy and Eager Loading with Object Properties
Lazy and Eager Loading with Object Properties
Welcome to the fourth chapter of this series on implementing lazy and eager loading in PHP 5. In five friendly tutorials, this series walks you through the basics of using these powerful approaches for including classes on request in your scripts, and teaches you how to work with these patterns when manipulating properties of a certain class.
Without a doubt, grasping the key concepts that surround the implementation of the lazy and eager loading design patterns in PHP 5 can be of great help when it comes to developing web-based applications that handle their resources in a truly efficient way.
So, if youíre a PHP programmer who wants to expand your existing skills by learning how to apply the aforementioned patterns in some concrete cases, then donít look any further, because youíve come to the right place.
And now that youíre aware of the objective of this group of tutorials, itís time to review briefly the concepts that were deployed in the previous article. In that installment of this series I demonstrated how to take advantage of the functionality given by lazy loading to include a basic class only when a script really required it. Not earlier, and not later neither.
This was accomplished thanks to the development of a resource-loader module, which exploited the nifty autoloading capabilities offered by PHP 5 to include the mentioned class on demand.
However, as I stated in earlier chapters of the series, lazy and eager loading can be used in multiple scenarios and situations, naturally with different results. So, in this fourth episode Iím going to explain how to utilize the eager loading pattern when handling the properties declared by the same ďUserĒ class that you learned in the previous tutorial.
Want to find out how this will be achieved in a few simple steps? Then begin reading right now!