The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Ok, more ideas comming up - after the insane amount of ORM threads here on sitepoint, this is my current idea(it would only allow one DB connection at a time to be active, I could do some type of selfcontained static registry for the model to allow more - but for now this will suffice), there would be some static abuse(Model + UoW + IDMap = static) to get a better "feel" to it and being able to create mappers / domain objects as you wish.

If you don't want any special functionallity there's no need to create the "Person" class as it will be created automaticly at runtime for you - if you wan't other stuff in there go ahead and create your own, etc.

It's either this(If I can get it to work and many people feel it's a nice approach) or I'm going with a table data gateway ;p. This is by far the most "clean" approach I've come up with as I wan't to have fieldbinding so you can select what fields to use and what name they should have on the object.

Edit:

Model_Mapper::internal() should maybe be named embedded() instead, can't realy decide on a nameing for it

I wast thinking about adding a Model_Mapper::use(str field [, str field [, ...] ]) method that would allow you to do this: $this->use("name","currency","age"); which would basicly be a shortcut to calling $this->bind("name"); $this->bind("currency"); and $this->bind("age"); if you just want to use them under thier table name without any typecasting.

It's either this(If I can get it to work and many people feel it's a nice approach) or I'm going with a table data gateway ;p. This is by far the most "clean" approach I've come up with as I wan't to have fieldbinding so you can select what fields to use and what name they should have on the object.

Edit:

Model_Mapper::internal() should maybe be named embedded() instead, can't realy decide on a nameing for it

Looks fine, looks like you've chosen to single column PKs, in the in both the bind() and has*()?