Review and next steps

When we have completed this step, all of our SQL statements will be inside Gateway classes, and no longer in our page scripts or other non-Gateway classes. We will also have tests for our Gateway classes.

From here on out, any time we need to add new calls to the database, we will do so only in the Gateway classes. Any time we need to fetch or save data, we will use the Gateway methods instead of writing embedded SQL. This gives us a clear separation of concerns between the database interactions and our future model layer and entity objects.

Now that we have separated our database interactions into their own layer, we are going to inspect all the calls to the Gateway objects throughout the legacy application. We will examine ...

Get Modernizing Legacy Applications in PHP 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.