views:

217

answers:

4

Actually, I'm looking for a framework which helps me using a "Data Mapper" pattern. I have noticed that a lot of PHP framework propose an "Active Record" implementation...

I found the "Active Record" too poor for managing "functional data"... It also seems simpler to handle "complex transactions" with this pattern, or to handle non-DBMS backends...

Does anybody know of a PHP framework which handles "Data Mapper" pattern ? Or a PHP framework which handles "Transactions" independently from DBMS ?

+1  A: 

Doctrine 2.0 is what I think you need. It offers transparent persistence for your objects. It requires php 5.3 though.

blockhead
+2  A: 

Doctrine coupled with Zend Framework, here is a guide to integrating the two.

The following section tries to explain where Doctrine stands in the world of ORM tools. The Doctrine ORM is mainly built around the Active Record, Data Mapper and Meta Data Mapping patterns.

CakePHP will be providing data mapper functionality in the 2.x releases.

Roadmap / Major Features

  • Model Refactoring
  • Extending beyond the "almost" Active Record existing
  • Interpretation of the Data Mapper design pattern
  • Returning Objects from model interactions
  • ArrayAccess to allow backwards compatability

Symfony

The relational database information must be mapped to an object model. This can be done with an ORM tool and thankfully, symfony comes bundled with two of them: Propel and Doctrine.

Codeigniter Datamapper

DataMapper is an Object Relational Mapper written in PHP for CodeIgniter. It is designed to map your Database tables into easy to work with objects, fully aware of the relationships between each other.

Peter Lindqvist
I didn't know of Doctrine's capabilities with the Data Mapper pattern... I will look further with this one.
Arno
+1  A: 

Doctrine is one of the best object-relationship mapper frameworks out there for PHP.

Gergely Orosz
A: 

Doctrine is totally capable of this and is natively built into the Symfony PHP framework.

The Doctrine project is now mangaged by the Symfony team.

Jon Winstanley