Permalink
Browse files

Fix composer.json and autoloading issue

  • Loading branch information...
1 parent 7871f68 commit 339ecbc83ad17a784c3245e141ec2baf8cd5838f @beberlei beberlei committed Mar 5, 2012
Showing with 19 additions and 4 deletions.
  1. +15 −3 DoctrineCouchDBBundle.php
  2. +4 −1 composer.json
View
18 DoctrineCouchDBBundle.php
@@ -15,6 +15,7 @@
namespace Doctrine\Bundle\CouchDBBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
+use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
@@ -23,6 +24,11 @@
class DoctrineCouchDBBundle extends Bundle
{
+ /**
+ * @var Closure
+ */
+ private $autoloader;
+
public function build(ContainerBuilder $container)
{
parent::build($container);
@@ -48,7 +54,7 @@ class_exists('Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver');
$dir = $this->container->getParameter('doctrine_couchdb.odm.proxy_dir');
$container = $this->container;
- spl_autoload_register(function($class) use ($namespace, $dir, $container) {
+ $this->autoloader = function($class) use ($namespace, $dir, $container) {
if (0 === strpos($class, $namespace)) {
$className = substr($class, strlen($namespace) +1);
$file = $dir.DIRECTORY_SEPARATOR.$className.'.php';
@@ -82,7 +88,13 @@ class_exists('Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver');
require $file;
}
- });
+ };
+ spl_autoload_register($this->autoloader);
}
}
-}
+
+ public function shutdown()
+ {
+ spl_autoload_unregiter($this->autoloader);
+ }
+}
View
5 composer.json
@@ -11,9 +11,12 @@
],
"require": {
"php": ">=5.3.2",
- "doctrine/couchdb-odm": "*",
+ "doctrine/couchdb": "*",
"symfony/symfony": "2.1.*"
},
+ "suggest": {
+ "doctrine/couchdb-odm": "*"
+ },
"autoload": {
"psr-0": { "Doctrine\\Bundle\\DoctrineCouchDBBundle": "" }
},

0 comments on commit 339ecbc

Please sign in to comment.