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
This commit is contained in:
Fabien Potencier 2011-04-19 14:13:54 +02:00
commit 7b87a6143a
3 changed files with 7 additions and 5 deletions

View File

@ -165,10 +165,11 @@ abstract class DoctrineCommand extends Command
protected function findBasePathForBundle($bundle)
{
$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) {
throw new \RuntimeException("Something went terribly wrong.");
throw new \RuntimeException("Can't find base path for bundle. Path: $path , Destination: $destination");
}
return $destination;

View File

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

View File

@ -109,10 +109,11 @@ abstract class DoctrineODMCommand extends Command
protected function findBasePathForBundle($bundle)
{
$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) {
throw new \RuntimeException("Something went terribly wrong.");
throw new \RuntimeException("Can't find base path for bundle. Path: $path , Destination: $destination");
}
return $destination;