diff --git a/DataFixtures/AbstractDataHandler.php b/DataFixtures/AbstractDataHandler.php index 36b71fe..3c40480 100644 --- a/DataFixtures/AbstractDataHandler.php +++ b/DataFixtures/AbstractDataHandler.php @@ -62,19 +62,18 @@ abstract class AbstractDataHandler $this->dbMap = Propel::getDatabaseMap($connectionName); if (0 === count($this->dbMap->getTables())) { - foreach (array('src', 'vendor') as $path) { - $finder = new Finder(); - $files = $finder->files()->name('*TableMap.php') - ->in($this->getRootDir() . '/../' . $path) - ->exclude('PropelBundle') - ->exclude('Tests'); + $finder = new Finder(); + $files = $finder->files()->name('*TableMap.php') + ->in($this->getRootDir() . '/../src/') + ->in($this->getRootDir() . '/../vendor/') + ->exclude('PropelBundle') + ->exclude('Tests'); - foreach ($files as $file) { - $class = $this->guessFullClassName($file->getRelativePath(), basename($file, '.php')); + foreach ($files as $file) { + $class = $this->guessFullClassName($file->getRelativePath(), basename($file, '.php')); - if (null !== $class) { - $this->dbMap->addTableFromMapClass($class); - } + if (null !== $class && $this->isInDatabase($class, $connectionName)) { + $this->dbMap->addTableFromMapClass($class); } } }