Skip to content
Browse files

move default values into configuration

  • Loading branch information...
1 parent c043dbb commit c71d4f9fb19104ea9da4d3e86f84ae368c663235 @havvg havvg committed May 23, 2013
Showing with 12 additions and 9 deletions.
  1. +11 −9 DataFixtures/AbstractDataHandler.php
  2. +1 −0 DependencyInjection/Configuration.php
View
20 DataFixtures/AbstractDataHandler.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;
}
}
View
1 DependencyInjection/Configuration.php
@@ -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 c71d4f9

Please sign in to comment.
Something went wrong with that request. Please try again.