Browse Source

Merge remote branch 'ivanrey/master'

* ivanrey/master:
  BugFix reflClass is not always initialized getReflClass should be used instead since it initializes the variable if it's not set
  Better Exception Message
  BugFix: In windows environments it is necessary to replace backslash with forward slash in search string as well
Fabien Potencier 14 years ago
parent
commit
7b87a6143a

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

@@ -165,10 +165,11 @@ abstract class DoctrineCommand extends Command
     protected function findBasePathForBundle($bundle)
     protected function findBasePathForBundle($bundle)
     {
     {
         $path = str_replace('\\', '/', $bundle->getNamespace());
         $path = str_replace('\\', '/', $bundle->getNamespace());
-        $destination = str_replace('/'.$path, "", $bundle->getPath(), $c);
+        $search = str_replace('\\','/',$bundle->getPath());
+        $destination = str_replace('/'.$path, "", $search, $c);
 
 
         if ($c != 1) {
         if ($c != 1) {
-            throw new \RuntimeException("Something went terribly wrong.");
+            throw new \RuntimeException("Can't find base path for bundle. Path: $path , Destination: $destination");
         }
         }
 
 
         return $destination;
         return $destination;

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php

@@ -60,7 +60,7 @@ EOT
             $entityGenerator = $this->getEntityGenerator();
             $entityGenerator = $this->getEntityGenerator();
 
 
             foreach ($metadatas as $metadata) {
             foreach ($metadatas as $metadata) {
-                if ($filterEntity && $metadata->reflClass->getShortName() !== $filterEntity) {
+                if ($filterEntity && $metadata->getReflClass()->getShortName() !== $filterEntity) {
                     continue;
                     continue;
                 }
                 }
 
 

+ 3 - 2
src/Symfony/Bundle/DoctrineMongoDBBundle/Command/DoctrineODMCommand.php

@@ -109,10 +109,11 @@ abstract class DoctrineODMCommand extends Command
     protected function findBasePathForBundle($bundle)
     protected function findBasePathForBundle($bundle)
     {
     {
         $path = str_replace('\\', '/', $bundle->getNamespace());
         $path = str_replace('\\', '/', $bundle->getNamespace());
-        $destination = str_replace('/'.$path, "", $bundle->getPath(), $c);
+        $search = str_replace('\\','/',$bundle->getPath());
+        $destination = str_replace('/'.$path, "", $search, $c);
 
 
         if ($c != 1) {
         if ($c != 1) {
-            throw new \RuntimeException("Something went terribly wrong.");
+            throw new \RuntimeException("Can't find base path for bundle. Path: $path , Destination: $destination");
         }
         }
 
 
         return $destination;
         return $destination;