A free and open-source book on ZF3 for beginners

12.16. Summary

Doctrine is not part of Zend Framework 3, but we cover its usage in this book because it provides an easy way of accessing a database and providing object persistence to your application.

In this chapter, we've covered the usage of the Object Relational Mapper (ORM) component of the Doctrine library. The ORM is designed for database management in an object-oriented style. With ORM, you map a database table to a PHP class known as an entity. Columns of that table are mapped to the properties of the entity class.

To load data from the database, you retrieve an entity from its repository. The repository is a class that can be considered as a collection of all available entities. The repository loads data from the corresponding database table, and fills one or more entity instance's fields with that data.