Permalink
Browse files

Merge pull request #1 from havvg/speedup-fixtures

move default values into configuration
  • Loading branch information...
2 parents c043dbb + c71d4f9 commit bfc8892b39385243147a5e3a8864cc141d372f1a @mheiniger mheiniger committed May 23, 2013
Showing with 12 additions and 9 deletions.
  1. +11 −9 DataFixtures/AbstractDataHandler.php
  2. +1 −0 DependencyInjection/Configuration.php
@@ -64,7 +64,7 @@ protected function loadMapBuilders($connectionName = null)
if (0 === count($this->dbMap->getTables())) {
$finder = new Finder();
$files = $finder->files()->name('*TableMap.php')
- ->in($this->getModelSearchPath($connectionName))
+ ->in($this->getModelSearchPaths($connectionName))
->exclude('PropelBundle')
->exclude('Tests');
@@ -122,23 +122,25 @@ private function guessFullClassName($path, $shortClassName)
}
/**
- * Gets the search path for models out of the configuration.
- *
- * @param string $connectionName A connection name.
- */
-
- private function getModelSearchPath($connectionName) {
+ * Gets the search path for models out of the configuration.
+ *
+ * @param string $connectionName A connection name.
+ *
+ * @return string[]
+ */
+ protected function getModelSearchPaths($connectionName) {
$configuration = Propel::getConfiguration();
$searchPath = array();
+
if (!empty($configuration['datasources'][$connectionName]['connection']['model_paths'])) {
$modelPaths = $configuration['datasources'][$connectionName]['connection']['model_paths'];
foreach ($modelPaths as $modelPath) {
$searchPath[] = $this->getRootDir() . '/../' . $modelPath;
}
} else {
- $searchPath[] = $this->getRootDir() . '/../src/';
- $searchPath[] = $this->getRootDir() . '/../vendor/';
+ $searchPath[] = $this->getRootDir() . '/../';
}
+
return $searchPath;
}
}
@@ -235,6 +235,7 @@ private function getDbalConnectionsNode()
->fixXmlConfig('model_path')
->children()
->arrayNode('model_paths')
+ ->defaultValue(array('src/', 'vendor/'))
->prototype('scalar')->end()
->end()
->end()

0 comments on commit bfc8892

Please sign in to comment.