PHP Classes
Icontem

Subject: PHP Object-Relational Mapping


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend!

      PHP Classes blog   PHP Object-Relational...   All threads   PHP Object-Relational Mapping   (Un) Subscribe thread alerts  
Subject:PHP Object-Relational Mapping
Summary:Confusing persistence layer with Object Relational Mapping?
Messages:2
Author:Jeroen Sen
Date:2008-10-09 19:27:35
Update:2008-10-10 01:05:26
 

  1. PHP Object-Relational Mapping   Reply  
Picture of Jeroen Sen
Jeroen Sen
2008-10-09 21:29:23
First of all I would like to say that I think you did a great job on writing the piece above. The only thing which bothers me is that it is not about Object Relational Mapping but it is about the use of a persistence layer.

The reason why I say this is that the modeling of your object is dependend on the database. Objects are modeled as tables. In a true Object Relation Mapping situation the implementation of a pattern (like the active record pattern) for building your models just narrows your vision and leads you away from the way you normally would model an object. (In the normal world it would frequently be the case that you model an object like it was an active records but there are also numerous cases where you wouldn't.)

A good starting point to look (and study on) a good example of an Object Relational Mapping prototype with a comprehensive and detailed explanation of all the problems that were ran into can be found in the Java world. In the book "Java Persistence with Hibernate" such a case is described.

These are just my two cents...

  2. Re: PHP Object-Relational Mapping   Reply  
Picture of Manuel Lemos
Manuel Lemos
2008-10-10 01:05:26
That is what the article mentioned. When you depart from the database to model your persistent objects, ActiveRecord pattern is sufficient for simple cases of an object that maps to a single table. For cases with relationships it becomes complicated.

In the case of Metastorage, it generates persistent objects classes code that handles relationships very well and the developer does not have to handle with details such as intermediate tables, like in the case of many-to-many relatioships.

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2008 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products