fbpx

Blog

SOFTLOFT / Blog  / Zend Framework and Doctrine 2. Why we use them in tandem

Zend Framework and Doctrine 2. Why we use them in tandem

It’s a well-known fact that Zend Framework is one of the best positioned frameworks for developing PHP web applications. It can be used as a kit of several components, or as a full MVC or VC framework. But at some point, especially while working with big databases, writing mapper-classes can become quite a trouble. One thing a developer could do is to rely on one of the great ORMs out there. Doctrine 2 is one of the most popular ORMs for PHP. So why not to use two such brilliant technologies in combination?


Doctrine can be integrated into Zend Framework 2 as a module which provides all the libraries and configuration as an independent set. Installing Doctrine 2 as a module is not too complicated. The most common way to do it is using Composer to install the modules into the project directory, and then modify them a bit with several configuration files. We strongly discourage you from not using Composer, as it is an easy way to install dependencies and to have all the autoloaders set up. By the way, Zend Framework 2 is downloaded via composer by default.
Main steps are: downloading Doctrine 2, configuring the application, creation the entity folder. It is not extremely difficult process but the result simplifies web development considerably. Doctrine 2 also provides developers with a tool for the command line interface; those files can be used to issue several doctrine commands e.g. such as generating a database schema based on previously built mapping files.
In a word, Zend Framework and Doctrine 2 ORM work perfectly together; and we don’t see any reason to neglect the benefits could be won with their combination.