Having a ponder over my data access with my mapper classes. Where I have data-centric classes (ie; an "Customer") which maps directly to a Customer record in the database, and there is an equivalent mapper. (On a tangent, I'm still unsure how to factor classes like these out as I get the impression they're considered bad-practise?).

With the mapper, there's the usual update/insert functions, but say I have a customer, which has a collection of addresses. the addresses similarly have their own mappers, so code flow would be something like:

update customer
foreach addresss

I typically use postgres functions to do handle this, but what if I don't have the luxury of functions on postgres and have to do it inside the objects? I'm thinking something like a "CustomerWriter" class;

PHP Code:
class CustomerWriter
$db->query('BEGIN TRANSACTION');
$cm =& new CustomerMapper();
$result $cm->save($this->customer);
      if (

Is my line of thought here any good?

Thanks for any help,