Doctrine (PHP)

Doctrine or phpDoctrine is a framework for object-relational mapping (English object- relational mapping, ORM) for PHP 5.3.0 . Doctrine has been developed from the viewpoint of the speed and richness of functionality. Jonathan Wage, since 2007 Project Manager at Doctrine, explains: " An ORM is an abstraction layer between the relational database and the actual application. Instead of using SQL you can object oriented access to the data by the ORM. "

The framework is built on top of a powerful database abstraction layer. By Doctrine is using PHP to easily access different database types are possible, such as MySQL. The principle of Doctrine also draws on ideas from Hibernate. For this purpose, the proprietary SQL language is called Doctrine Query Language ( DQL ) for carrying, which was inspired by HQL hibernates.

Programmers working with Doctrine, their queries no longer need to formulate in SQL. The object-oriented approach allows for an abstract work regardless of the database used. Also, database content can be managed object oriented, without providing a wrapper for it. The object- relational functionality itself is assigned here to the objects without any complicated programming in PHP is required. In this way, the management of a software project much simpler.

Example of use

When a new user object in the database is to be created as an example, written in PHP that could look like this:

$ user = new User ();   $ user -> setName ( "Max" );   $ user -> setPassword ("test" );   $ EntityManager -> persist ( $ user );   $ EntityManager -> flush ();  . . echo "The user with ID " $ user-> getId ( ) "was added successfully. "; Here, the called entity manager Doctrine is instructed to store an object ( model ). The Entity Manager manages models and serves as an interface to the database.

243473
de