Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.