Skip to content

Instantly share code, notes, and snippets.

@settermjd
Created November 24, 2013 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save settermjd/7629664 to your computer and use it in GitHub Desktop.
Save settermjd/7629664 to your computer and use it in GitHub Desktop.
public function getServiceConfig()
{
return array(
'CountryDebtTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$hydrator = new \MaltBlue\Hydrator\TableEntityMapper(array(
'CountryID' => 'countryId',
'DebtId' => 'debtId',
'DebtLevel' => 'debtLevel',
));
$rowObjectPrototype = new \MaltBlue\Model\CountryDebt;
$resultSet = new \Zend\Db\ResultSet\HydratingResultSet($hydrator, $rowObjectPrototype);
return new TableGateway('tblcountrydebt', $dbAdapter, null, $resultSet);
},
'MaltBlue\Model\CountryDebtTable' => function($sm) {
$tableGateway = $sm->get('CountryDebtTableGateway');
$table = new CountryDebtTable($tableGateway);
try {
$cacheAdapter = $sm->get('Application\Cache');
$table->setCache($cacheAdapter);
} catch (\Exception $e) {
// log that it wasn't available
}
return $table;
},
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment