A free and open-source book on Zend Framework for beginners

12. Database Management with Doctrine ORM

Doctrine is an open-source PHP library providing convenient methods for managing your database in an object-oriented way. For working with relational databases, Doctrine provides a component named Object Relational Mapper (ORM for short). With Doctrine ORM you map your database table to a PHP class (in terms of Domain Driven Design, it is also called an entity class) and a row from that table is mapped to an instance of the entity class. If you are new to Doctrine, it is recommended that you also refer to Appendix D. Introduction to Doctrine for introductory information about the Doctrine library architecture.

Doctrine is a third-party library, it is not part of Zend Framework 3. We cover it in this book because it provides an easy way of adding database support to your ZF3-based web application.

Components covered in this chapter:

Component Description
Doctrine\ORM Implements Object-Relational Mapper.
DoctrineORMModule Easy integration of Doctrine ORM with ZF3.
Zend\Paginator Support of pagination.