In this chapter, we have taken a look at some of the extended functionality offered by PDO, especially transactions. Our application example was modified to provide additional functionality that relies on transactions. We also looked at the organization of the transaction-aware code.
However, as you might have noticed, we were mixing code that updates databases, processes user input, and renders pages in one file. While we tried to keep the input processing and presentation in different parts of one file (first data processing, then page rendering), we could not separate data processing.
In the next chapter, we will see how to separate the data model and the application logic so that the data can be accessed and manipulated from elsewhere, not just from our application. We will develop a data model class that will encapsulate our library application data handling methods. This class can then be used from other applications.