In ZF2 there was such thing like Data Mapper (you can see this answer: What is the difference between the Data Mapper, Table Data Gateway (Gateway), Data Access Object (DAO) and Repository patterns?
But if You are using ZF2 this problem has bees solved and the most efficient way to communicate with database is TableGateway with defined ResultSetPrototype (as one of models with exchangeArray function) and ofc trough Zend/Db/Adapter class here is sample how i do it in ZF2:
IN SERVICE.CONFIG:
'Gallery\Model\AnythingListTable' => function($sm) {
$tableGateway = $sm->get('AnythingListTableGateway');
$table = new AnythingListTable($tableGateway);
return $table;
},
'AnythingListTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Anything());
return new TableGateway('Anything', $dbAdapter, null, $resultSetPrototype);
},
AnythingTable is one model (with functions to manipulate database)
Anything is second model with filters and rules about data form DB