Created
October 22, 2013 14:17
-
-
Save ppeiris/7101531 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
<?php | |
namespace Zsend; | |
use Zsend\Listener; | |
use Zend\Mvc\MvcEvent; | |
class Module | |
{ | |
public function getAutoloaderConfig() | |
{ | |
/** Autoloading config */ | |
} | |
public function getConfig() | |
{ | |
/** get config code */ | |
} | |
/** | |
* Return the service config | |
*/ | |
public function getServiceConfig() { | |
return array( | |
'factories' => array( | |
/** Add the SendListener class in to the service manager */ | |
'Zsend\Listener\SendListener' => function($servicemanager){ | |
/** return the object of the SendListener class (service manager injected uisng dependency injection) */ | |
return new Listener\SendListener(); | |
}, | |
), | |
); | |
} | |
/** | |
* Attach the event listeners using EventManager. | |
* | |
*/ | |
public function onBootstrap(MvcEvent $event) { | |
/* get the Event Manager from the application */ | |
$eventManager = $event->getApplication()->getEventManager(); | |
/** | |
* Have the access to the service manager as follows | |
* Zsend\Listener\SendListener class implements the ListenerAggregateInterface | |
*/ | |
$SendListener_Obj = $event->getApplication()->getServiceManager()->get('Zsend\Listener\SendListener') | |
/** Attach the event */ | |
$eventManager->attach($SendListener_Obj); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment