Browse Source

fix doctrine command getBundleMetadatas function

Thomas 14 years ago
parent
commit
d9239d1c64
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/Symfony/Bundle/DoctrineBundle/Command/DoctrineCommand.php

+ 5 - 3
src/Symfony/Bundle/DoctrineBundle/Command/DoctrineCommand.php

@@ -133,7 +133,7 @@ abstract class DoctrineCommand extends Command
     protected function getBundleMetadatas(Bundle $bundle)
     {
         $tmp = dirname(str_replace('\\', '/', get_class($bundle)));
-        $namespace = str_replace('/', '\\', dirname($tmp));
+        $namespace = $bundle->getNamespacePrefix().'\\'.$bundle->getName();
         $class = basename($tmp);
 
         $bundleMetadatas = array();
@@ -142,11 +142,13 @@ abstract class DoctrineCommand extends Command
             $cmf = new SymfonyDisconnectedClassMetadataFactory($em);
             $metadatas = $cmf->getAllMetadata();
             foreach ($metadatas as $metadata) {
-                if (strpos($metadata->name, $namespace) !== false) {
-                    $bundleMetadatas[] = $metadata;
+
+                if (strpos($metadata->name, $namespace) === 0) {
+                    $bundleMetadatas[$metadata->name] = $metadata;
                 }
             }
         }
+
         return $bundleMetadatas;
     }
 }