diff --git a/src/Symfony/Framework/PropelBundle/Bundle.php b/src/Symfony/Framework/PropelBundle/Bundle.php index aa9af4a65a..21cf62f1ba 100644 --- a/src/Symfony/Framework/PropelBundle/Bundle.php +++ b/src/Symfony/Framework/PropelBundle/Bundle.php @@ -17,6 +17,12 @@ class Bundle extends BaseBundle public function boot(ContainerInterface $container) { + require_once $container->getParameter('propel.path').'/runtime/lib/Propel.php'; + + if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) { + set_include_path($container->getParameter('propel.phing_path').'/classes'.PATH_SEPARATOR.get_include_path()); + } + $kernel = $container->getKernelService(); if (!file_exists($autoload = $kernel->getCacheDir().'/propel_autoload.php')) { $map = array(); diff --git a/src/Symfony/Framework/PropelBundle/Command/BuildCommand.php b/src/Symfony/Framework/PropelBundle/Command/BuildCommand.php index f6a3790e2e..c89400caed 100644 --- a/src/Symfony/Framework/PropelBundle/Command/BuildCommand.php +++ b/src/Symfony/Framework/PropelBundle/Command/BuildCommand.php @@ -135,7 +135,7 @@ class BuildCommand extends Command // Build file $args[] = '-f'; - $args[] = realpath($kernel->getContainer()->getParameter('propel.generator.path').DIRECTORY_SEPARATOR.'build.xml'); + $args[] = realpath($kernel->getContainer()->getParameter('propel.path').'/generator/build.xml'); /* // Logger diff --git a/src/Symfony/Framework/PropelBundle/DependencyInjection/PropelExtension.php b/src/Symfony/Framework/PropelBundle/DependencyInjection/PropelExtension.php index 8dacb96b8c..156d26e72e 100644 --- a/src/Symfony/Framework/PropelBundle/DependencyInjection/PropelExtension.php +++ b/src/Symfony/Framework/PropelBundle/DependencyInjection/PropelExtension.php @@ -15,20 +15,25 @@ class PropelExtension extends LoaderExtension ); /** - * Loads the DBAL configuration. + * Loads the Propel configuration. * * @param array $config A configuration array * * @return BuilderConfiguration A BuilderConfiguration instance */ - public function generatorLoad($config) + public function configLoad($config) { if (!isset($config['path'])) { throw new \InvalidArgumentException('The "path" parameter is mandatory.'); } $configuration = new BuilderConfiguration(); - $configuration->setParameter('propel.generator.path', $config['path']); + $configuration->setParameter('propel.path', $config['path']); + + if (isset($config['phing_path'])) + { + $configuration->setParameter('propel.phing_path', $config['phing_path']); + } return $configuration; } diff --git a/src/Symfony/Framework/PropelBundle/README b/src/Symfony/Framework/PropelBundle/README index 795b684238..e82eb83f89 100644 --- a/src/Symfony/Framework/PropelBundle/README +++ b/src/Symfony/Framework/PropelBundle/README @@ -23,8 +23,9 @@ Sample Configuration ### Project configuration # in sandbox/hello/config/config.yml - propel.generator: - path: %kernel.root_dir%/../src/vendor/propel/generator + propel.config: + path: %kernel.root_dir%/../src/vendor/propel + phing_path: %kernel.root_dir%/../src/vendor/phing propel.dbal: driver: mysql @@ -41,38 +42,7 @@ Sample Configuration # dsn: mysql:host=localhost;dbname=test # options: {} -### Autoloading - - // in src/autoload.php - registerNamespaces(array( - 'Symfony' => __DIR__.'/vendor/symfony/src', - 'Application' => __DIR__, - 'Bundle' => __DIR__, - 'Doctrine' => __DIR__.'/vendor/doctrine/lib', - )); - $loader->registerPrefixes(array( - 'Swift_' => __DIR__.'/vendor/swiftmailer/lib/classes', - 'Zend_' => __DIR__.'/vendor/zend/library', - )); - $loader->register(); - - require_once __DIR__.'/vendor/propel/runtime/lib/Propel.php'; - - set_include_path( - __DIR__.'/vendor/phing/classes'.PATH_SEPARATOR. - __DIR__.'/vendor/zend/library'.PATH_SEPARATOR. - __DIR__.'/vendor/swiftmailer/lib'.PATH_SEPARATOR. - get_include_path() - ); - Known Problems -------------- -Your application must not be un a path inclufing dots in directory names (i.e. '/Users/me/symfony/2.0/sandbox/' fails). \ No newline at end of file +Your application must not be in a path including dots in directory names (i.e. '/Users/me/symfony/2.0/sandbox/' fails).