rafi_ccj

Untitled

Jun 22nd, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Album;
  4.  
  5. use Album\Model\Album;
  6. use Album\Model\AlbumTable;
  7. use Zend\Db\ResultSet\ResultSet;
  8. use Zend\Db\TableGateway\TableGateway;
  9.  
  10. class Module {
  11.  
  12. public function getAutoloaderConfig() {
  13. return array(
  14. 'Zend\Loader\ClassMapAutoloader' => array(
  15. __DIR__ . '/autoload_classmap.php',
  16. ),
  17. 'Zend\Loader\StandardAutoloader' => array(
  18. 'namespaces' => array(
  19. __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
  20. ),
  21. ),
  22. );
  23. }
  24.  
  25. public function getConfig() {
  26. return include __DIR__ . '/config/module.config.php';
  27. }
  28.  
  29. public function getServiceConfig() {
  30. return array(
  31. 'factories' => array(
  32. 'Album\Model\AlbumTable' => function($sm) {
  33. $tableGateway = $sm->get('AlbumTableGateway');
  34. $table = new AlbumTable($tableGateway);
  35. return $table;
  36. },
  37. 'AlbumTableGateway' => function ($sm) {
  38. $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
  39. $resultSetPrototype = new ResultSet();
  40. $resultSetPrototype->setArrayObjectPrototype(new Album());
  41. return new TableGateway('album', $dbAdapter, null, $resultSetPrototype);
  42. },
  43. ),
  44. );
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment