PdoMap (PHP)
Encyclopedia
pdoMap is a PHP
ORM (object-relational mapping
) framework released under (LGPL). The main aim of this project is to provide to PHP developers a RAD framework and a new way of dealing with databases.
This version was based on the XSD datasource mapping format provided by .NET datasets. This version is available on repository at : http://pdomap.svn.sourceforge.net/viewvc/pdomap/tags/1.5/
Project was restart from scratch based on a new XML format, closer to Hibernate format declaration.
and the adapter pattern
to map each table resulting in two classes for each database table
. One represents a record entity, and the other one represents a service adapter for the table.
For example, the following PHP code creates a new user :
In order to get this user from database, there's no need in selecting SQL or creating a complex object query :
Example of a simplified XML which could be used in the above code:
Example of how to call the login query as defined in the XML block above:
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
ORM (object-relational mapping
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...
) framework released under (LGPL). The main aim of this project is to provide to PHP developers a RAD framework and a new way of dealing with databases.
History
The project was started in April 2008 :- 1.x version (from april 2008 to september 2009) :
This version was based on the XSD datasource mapping format provided by .NET datasets. This version is available on repository at : http://pdomap.svn.sourceforge.net/viewvc/pdomap/tags/1.5/
- 2.x version (from september 2009 to now) :
Project was restart from scratch based on a new XML format, closer to Hibernate format declaration.
Usage demonstration
pdoMap combines the active record patternActive record pattern
In software engineering, the active record pattern is an architectural pattern found in software that stores its data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture...
and the adapter pattern
Adapter pattern
In computer programming, the adapter pattern is a design pattern that translates one interface for a class into a compatible interface...
to map each table resulting in two classes for each database table
Table (database)
In relational databases and flat file databases, a table is a set of data elements that is organized using a model of vertical columns and horizontal rows. A table has a specified number of columns, but can have any number of rows...
. One represents a record entity, and the other one represents a service adapter for the table.
For example, the following PHP code creates a new user :
In order to get this user from database, there's no need in selecting SQL or creating a complex object query :
Example of a simplified XML which could be used in the above code:
Example of how to call the login query as defined in the XML block above:
Features
- Focus on database design by managing structure in XML
- Mapping database tables with automatically generated classes from XML mapping files
- Provides a RAD environment that allows to write queries in an XML syntax
- Provides a programmatic SQL language compatible with all database engines
- Extensible field types (by default : primary / foreign / char / text / boolean / int / float / date)
- Provides deployment procedures and functionalities which create database and tables (including joins)
- Creates a service oriented classes by overriding tables adapters.
- Uses oriented event crud which enables interaction between the entities and advanced database logic.