Well I am considering working on an ORM system for my script, but there are some tough decision decisions to make. In Matt Zandstra's book PHP Object, Patterns and Practices, he introduces several possible database design patterns. Among them the most recommended ones are data mapper and identity object, I still have a few confusions though.

  1. What does a Domain Model fit in the world of MVC? Is it pretty much a Model? Or is it just some kind of strongly typed Raw Data with no functionalities?
  2. Are Domain Models supposed to keep a reference of Mapper object? Or are they only supposed to hold data?
  3. What is the difference between a Domain Model Object and an Identity Object? Is Identity Object the same as Doctrine/Propel's Entity Object?

Sorry for asking this many questions at the same time, I just really hope to get a complete understanding of how these are supposed to work. It seems that Symfony has an ORM system inside its MVC architecture design, so apparently ORM and MVC aint incompatible with each other. Right?

    Having no practical experience with MVC, this is from how I understand it works by reading about it. The model is responsible for mapping data between persistent storage, almost always a database, and making it accessible to your program, almost always class instances. ORM is a way to facilitate mapping data between databases and objects. Thus, your model can make use of an ORM to facilitate this mapping, and it will usually mean that you have to write less code for each particular table/object pair.

      Well I just wanna know what the relationship is between a Model in MVC and the objects in ORM. Is it safe to assume that in ORM the Model is decomposed into Mappers, Entities, Identity Maps/Object and possibly Domain Object Factory? Anyone of you familiar with Matt Zandstra's book chapter 13 on database patterns? o_o

        Write a Reply...