Introduction to Object-relational mapping June 13, 2010Posted by Tournas Dimitrios in PHP.
Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.
Any non trivial application has a database behind it . In fact if we look closely into any application, one will realize that the application gets more or less modeled around the data model. In database technology, relational database are the clear winners. Other database technologies has come and gone. Relational concept of data management was first introduced by E.F. Codd in 1970. An analogy for relational model can be drawn with spreadsheets. Each sheet represents a table and the columns in the sheet represent the table attributes. Each instance of data is represented by the rows. The data in different sheets are connected with each other by referring to the data point using the sheet number, column number and row number. This is what is called as foreign key relationship in database technology. In fact most of the GUI interfaces to database show the data in a spreadsheet format.
To interact with the database, Standard Query Language(SQL) has emerged as the standard way (SQL standards) .Almost all programming languages are using ORM-techniques to resolve the prementioned mapping .The list that folows is targeted to the PHP programming language ,it is neither up-to-date nor all-inclusive.
- CakePHP, ORM and framework for PHP5, open source (scalars, arrays, objects). Based on database introspection. No class extending or code generation
- Doctrine, Open Source ORM for PHP 5.2.3, free software (GNU LGPL)
- PdoMap, Open Source ORM for PHP 5.x, inspired by Hibernate, free software (GNU LGPL)
- Propel, ORM and Query-Toolkit for PHP 5, inspired by Apache Torque, free software (MIT)
- Rocks, Open Source ORM for PHP 5.1 plus, free for non-commercial use (GPL)
- Qcodo, ORM and framework for PHP5, open source
- Redbean, ORM layer for PHP 5 that creates and maintains tables on the fly (BSD)
- Torpor, Open Source ORM for PHP 5.1 plus, free software (MIT), database and OS agnostic
- Yupp PHP Framework, minimal framework that implements the MVC and an ORM patterns with no need to write any SQL.
This 10-minute video deals with the concept of ORM-Frameworks