Chapter 21. Data class design

21.1 The simplest approaches 471
21.2 Letting objects persist themselves 479
21.3 The Data Mapper pattern 486
21.4 Facing the real world 490
21.5 Summary 492

As we’ve seen, the marriage of a database and an object-oriented program is usually not a match made in heaven. It’s more of an arranged marriage, although casual relationships are also possible.

Some ceremony is helpful in getting the liaison started. The patterns presented by Martin Fowler in Patterns of Enterprise Application Architecture [P of EAA] are a good rough guide to the alternative ways of creating a systematic and lasting bond between data storage and program code. In this chapter, we will approach these patterns from a slightly different perspective, ...

Get PHP in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.