Created
November 24, 2013 17:15
-
-
Save settermjd/7629664 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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