Created
March 31, 2016 12:23
-
-
Save juizmill/ae4fa5dde6dd8577db1e55e904ae080c to your computer and use it in GitHub Desktop.
Exemple Module.php ZF2
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 | |
| namespace Base; | |
| use Zend\Mvc\I18n\Translator; | |
| use Zend\Mvc\ModuleRouteListener; | |
| use Zend\Mvc\MvcEvent; | |
| class Module | |
| { | |
| public function onBootstrap(MvcEvent $e) | |
| { | |
| $eventManager = $e->getApplication()->getEventManager(); | |
| $moduleRouteListener = new ModuleRouteListener(); | |
| $moduleRouteListener->attach($eventManager); | |
| $translator = new Translator(); | |
| $translator->addTranslationFile( | |
| 'phpArray', | |
| './vendor/zendframework/zendframework/resources/languages/pt_BR/Zend_Validate.php', | |
| 'default', | |
| 'pt_BR' | |
| ); | |
| \Zend\Validator\AbstractValidator::setDefaultTranslator($translator); | |
| } | |
| 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__, | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment