Permalink
Browse files

Added namespace autoloading for non-Composer users.

  • Loading branch information...
1 parent f800978 commit e6882e7cb1155674cd39c69c014e18dff1ab51af @Bilge Bilge committed Aug 2, 2012
Showing with 34 additions and 4 deletions.
  1. +7 −0 Module.php
  2. +27 −4 src/DoctrineMongoODMModule/Module.php
View
@@ -0,0 +1,7 @@
+<?php
+/**
+ * This file is placed here for compatibility with Zendframework 2's ModuleManager.
+ * It allows usage of this module even without composer.
+ * The original Module.php is in 'src/DoctrineMongoODMModule' in order to respect PSR-0
+ */
+require_once __DIR__ . '/src/DoctrineMongoODMModule/Module.php';
@@ -21,8 +21,13 @@
use DoctrineModule\Service as CommonService;
use DoctrineMongoODMModule\Service as ODMService;
-use Zend\EventManager\Event;
+use Zend\EventManager\EventInterface;
+use Zend\ModuleManager\Feature\BootstrapListenerInterface;
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
+use Zend\Loader\AutoloaderFactory;
+use Zend\Loader\StandardAutoloader;
/**
* Doctrine Module provider for Mongo DB ODM.
@@ -32,14 +37,15 @@
* @since 0.1.0
* @author Tim Roediger <superdweebie@gmail.com>
*/
-class Module implements ServiceProviderInterface
+class Module implements BootstrapListenerInterface, AutoloaderProviderInterface, ConfigProviderInterface, ServiceProviderInterface
{
/**
+ * {@inheritDoc}
*
* @param \Zend\EventManager\Event $event
*/
- public function onBootstrap(Event $event)
+ public function onBootstrap(EventInterface $event)
{
$app = $event->getTarget();
$sharedManager = $app->getEventManager()->getSharedManager();
@@ -52,7 +58,8 @@ public function onBootstrap(Event $event)
*
* @param \Zend\EventManager\Event $event
*/
- public function loadCli(Event $event){
+ public function loadCli(Event $event)
+ {
$cli = $event->getTarget();
$cli->addCommands(array(
new \Doctrine\ODM\MongoDB\Tools\Console\Command\QueryCommand(),
@@ -70,6 +77,21 @@ public function loadCli(Event $event){
}
/**
+ * {@inheritDoc}
+ *
+ * @return array
+ */
+ public function getAutoloaderConfig()
+ {
+ return array(
+ AutoloaderFactory::STANDARD_AUTOLOADER => array(
+ StandardAutoloader::LOAD_NS => array(__NAMESPACE__ => __DIR__)
+ )
+ );
+ }
+
+ /**
+ * {@inheritDoc}
*
* @return array
*/
@@ -79,6 +101,7 @@ public function getConfig()
}
/**
+ * {@inheritDoc}
*
* @return array
*/

0 comments on commit e6882e7

Please sign in to comment.