Created
August 3, 2013 17:06
-
-
Save eminetto/6147147 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <?php | |
| /** | |
| * Zend Framework (http://framework.zend.com/) | |
| * | |
| * @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository | |
| * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | |
| * @license http://framework.zend.com/license/new-bsd New BSD License | |
| */ | |
| namespace Aluno; | |
| use Zend\Db\TableGateway\TableGateway; | |
| use Aluno\Model\AlunoTable; | |
| use Aluno\Model\Aluno; | |
| use Zend\Db\ResultSet\ResultSet; | |
| use Zend\Mvc\ModuleRouteListener; | |
| use Zend\Mvc\MvcEvent; | |
| class Module | |
| { | |
| public function onBootstrap(MvcEvent $e) | |
| { | |
| $e->getApplication()->getServiceManager()->get('translator'); | |
| $eventManager = $e->getApplication()->getEventManager(); | |
| $moduleRouteListener = new ModuleRouteListener(); | |
| $moduleRouteListener->attach($eventManager); | |
| } | |
| public function getConfig() | |
| { | |
| return include __DIR__ . '/config/module.config.php'; | |
| } | |
| public function getAutoloaderConfig() | |
| { | |
| return array( | |
| 'Zend\Loader\StandardAutoloader' => array( | |
| 'namespaces' => array( | |
| __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, | |
| ), | |
| ), | |
| ); | |
| } | |
| public function getServiceConfig() | |
| { | |
| return array( | |
| 'factories' => array( | |
| 'Aluno\Model\AlunoTable' => function($sm) { | |
| $tableGateway = $sm->get('AlunoTableGateway'); | |
| $table = new AlunoTable($tableGateway); | |
| return $table; | |
| }, | |
| 'AlunoTableGateway' => function ($sm) { | |
| $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter'); | |
| $resultSetPrototype = new ResultSet(); | |
| $resultSetPrototype->setArrayObjectPrototype(new Aluno()); | |
| return new TableGateway('aluno', $dbAdapter, null, $resultSetPrototype); | |
| }, | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment