[In the Works] Datamapper ORM Class |
[eluser]andyr[/eluser]
It was nice to see a post about DataMapper pattern, from what i can see the posted code does match was is too be expected. As to quote Martin Folwer, Quote:A data mapper is a layer of mappers, that move data between objects and a database while keeping them independent of each other and the mapper itself. Your "model" objects appear to be domain object, which encapsulates all of the data and business behavior associated with the entity (table) that it represents. All these domain objects will eventually build up your domain model. From the view of the DataMapper, i am guessing your using an abstraction similar too this PHP5 class, obviously the PHP4 implementation will be different, but concept remains the same. Code: abstract class Mapper() { Some structural and behavioural concerns which will need to be thought about before they raise their ugly heads. - How will you know when to insert or update a business transaction? Can the domain objects be retrieved from a cache? How can concurrency be maintained in the sense from preventing duplicate transactions? (IdentityMap) - How will you manage, track and co-ordinate a large number of business transactions? How will you know which domain object has too be inserted, updated or has been deleted? (Unit of Work) - How will you deal with mapping between one-one, one-many and many-many relationships? (Inheritance Mapping) - If a table has many associations with other tables, how will the object inheritance manage performance implications from loading a large number of objects? (Lazy Loading) I would recommend that you get your hands of "Patterns of Enterprise Application Architecture" by Martin Folwer, and "PHP 5 Object, Patterns and Practice" by Matt Zandstra which give a good introduction into building an ORM layer. http://martinfowler.com/eaaCatalog/dataMapper.html http://martinfowler.com/eaaCatalog/metadataMapping.html http://martinfowler.com/eaaCatalog/identityMap.html http://martinfowler.com/eaaCatalog/unitOfWork.html http://martinfowler.com/eaaCatalog/lazyLoad.html http://martinfowler.com/eaaCatalog/inher...ppers.html Good luck! |
Messages In This Thread |
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 06:50 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 06:56 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 07:26 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 07:31 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 07:36 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 09:00 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 09:31 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-27-2008, 09:34 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-28-2008, 02:10 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-28-2008, 09:52 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-28-2008, 12:32 PM
[In the Works] Datamapper ORM Class - by El Forum - 08-28-2008, 01:03 PM
[In the Works] Datamapper ORM Class - by El Forum - 08-28-2008, 09:13 PM
[In the Works] Datamapper ORM Class - by El Forum - 08-29-2008, 04:27 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-29-2008, 04:37 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-29-2008, 06:25 AM
[In the Works] Datamapper ORM Class - by El Forum - 08-29-2008, 06:59 PM
[In the Works] Datamapper ORM Class - by El Forum - 08-30-2008, 08:09 AM
[In the Works] Datamapper ORM Class - by El Forum - 09-01-2008, 06:24 AM
[In the Works] Datamapper ORM Class - by El Forum - 09-01-2008, 08:11 AM
[In the Works] Datamapper ORM Class - by El Forum - 10-21-2008, 06:25 PM
[In the Works] Datamapper ORM Class - by El Forum - 10-30-2008, 01:44 PM
[In the Works] Datamapper ORM Class - by El Forum - 10-30-2008, 01:46 PM
|