Merge pull request #399 from thomaschaaf/2.0

Fix model_paths
This commit is contained in:
Toni Uebernickel 2016-03-28 12:29:12 +02:00
commit 91e930fedc
3 changed files with 8 additions and 3 deletions

View file

@ -168,7 +168,7 @@ EOT
return -1; return -1;
} }
$connectionName = $input->getOption('connection'); $connectionName = $input->getOption('connection') ?: $this->getDefaultConnection();
if ('yml' === $type) { if ('yml' === $type) {
$loader = $this->getContainer()->get('propel.loader.yaml'); $loader = $this->getContainer()->get('propel.loader.yaml');

View file

@ -146,8 +146,8 @@ abstract class AbstractDataHandler
{ {
$searchPath = array(); $searchPath = array();
if (!empty($this->datasources[$connectionName]['connection']['model_paths'])) { if (!empty($this->datasources['database']['connections'][$connectionName]['model_paths'])) {
$modelPaths = $this->datasources[$connectionName]['connection']['model_paths']; $modelPaths = $this->datasources['database']['connections'][$connectionName]['model_paths'];
foreach ($modelPaths as $modelPath) { foreach ($modelPaths as $modelPath) {
$searchPath[] = $this->getRootDir() . '/../' . $modelPath; $searchPath[] = $this->getRootDir() . '/../' . $modelPath;
} }

View file

@ -122,6 +122,7 @@ class Configuration extends PropelConfiguration
->useAttributeAsKey('id') ->useAttributeAsKey('id')
->prototype('array') ->prototype('array')
->fixXmlConfig('slave') ->fixXmlConfig('slave')
->fixXmlConfig('model_path')
->children() ->children()
->scalarNode('classname')->defaultValue($this->debug ? '\Propel\Runtime\Connection\DebugPDO' : '\Propel\Runtime\Connection\ConnectionWrapper')->end() ->scalarNode('classname')->defaultValue($this->debug ? '\Propel\Runtime\Connection\DebugPDO' : '\Propel\Runtime\Connection\ConnectionWrapper')->end()
->scalarNode('adapter') ->scalarNode('adapter')
@ -158,6 +159,10 @@ class Configuration extends PropelConfiguration
->booleanNode('ATTR_EMULATE_PREPARES')->defaultFalse()->end() ->booleanNode('ATTR_EMULATE_PREPARES')->defaultFalse()->end()
->end() ->end()
->end() ->end()
->arrayNode('model_paths')
->defaultValue(['src', 'vendor'])
->prototype('scalar')->end()
->end()
->arrayNode('settings') ->arrayNode('settings')
->fixXmlConfig('query', 'queries') ->fixXmlConfig('query', 'queries')
->children() ->children()