Saltar al contenido

Doctrine, ORM para PHP

Doctrine is an object-relational mapper (ORM) for PHP that provides persistence for PHP objects. It sits on top of a database abstraction layer. One of Doctrine’s key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL).

Features

One feature of Doctrine is the low level of configuration that is needed to start a project. Doctrine can generate object classes from an existing database, and the programmer can then specify relations and add custom functionality to the generated classes. There is no need to generate or maintain complex XML database schemas, as seen in many other frameworks.

Another key feature of Doctrine is the ability to optionally write database queries in an OO (object oriented) SQL dialect called DQL (Doctrine Query Language) inspired by Hibernate’s HQL. Alternately, the Doctrine_Query class allows one to construct queries through a fluent interface. These interfaces provide developers with powerful alternatives to SQL which maintain flexibility and still allow for switching of database back-ends, without requiring any code duplication.

Writing queries explicitly however is not always necessary, as Doctrine performs joins and fetches related objects automatically. Small projects can be easily constructed without writing queries.

Other notable features of Doctrine are:

  • Support for hierarchical (tree-structured) data;
  • Support for hooks (methods which can validate or modify database input and output) and event listeners to structure business-related logic;
  • Column aggregation inheritance (similar objects can be stored in one database table, with one type-column specifying the subtype of the particular object – the correct subclass is always returned when a query is done);
  • A caching framework, making use of several backends such as memcached, SQLite or APC;
  • ACID transactions;
  • Model behaviors (sluggable, timestampable, nested set, internationalization, audit log, search index);
  • Database migrations;
  • A «compile» function to combine many PHP files of the framework into one, to avoid the performance hit usually incurred by including the many PHP files of a framework.

Fuente: Wikipedia

 

Si te ha interesado este artículo y deseas un apoyo o asesoría en algún requerimiento, envíame un mensaje a: (info@juliopari.com) o sino a través de Linkedin: https://www.linkedin.com/in/juliopari/

Etiquetas: