From 5ce1a7d1e9032672bc4ce916e9c9208141ba718a Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 17 Feb 2015 13:45:17 +0100 Subject: [PATCH] Propel configuration and init --- app/console | 2 +- propel.yaml | 31 ++++++++++++++++++++++++++++++ src/Deblan/Console/Application.php | 8 +++++++- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 propel.yaml diff --git a/app/console b/app/console index f37b6ae..76c06d1 100755 --- a/app/console +++ b/app/console @@ -10,6 +10,6 @@ $app = new Application(); $app->chdir(__DIR__.'/../'); $app->addCommandsPath('src/Deblan/PowerDNS/Command/', 'Deblan\\PowerDNS\\Command'); - +$app->initPropel(); $app->loadCommands(); $app->run();; diff --git a/propel.yaml b/propel.yaml new file mode 100644 index 0000000..0e03bfc --- /dev/null +++ b/propel.yaml @@ -0,0 +1,31 @@ +propel: + database: + connections: + default: + adapter: mysql + classname: Propel\Runtime\Connection\ConnectionWrapper + dsn: "mysql:host=localhost;dbname=pdns" + user: root + password: root + attributes: + settings: + charset: utf8 + queries: + utf8: "SET NAMES utf8 COLLATE utf8_unicode_ci, COLLATION_CONNECTION = utf8_unicode_ci, COLLATION_DATABASE = utf8_unicode_ci, COLLATION_SERVER = utf8_unicode_ci" + + paths: + projectDir: src/ + schemaDir: src/ + outputDir: src/ + phpDir: src/ + phpConfDir: app/propel + sqlDir: app/propel/sql + migrationDir: app/propel/migration + + runtime: + defaultConnection: default + connections: [default] + + generator: + defaultConnection: default + connections: [default] diff --git a/src/Deblan/Console/Application.php b/src/Deblan/Console/Application.php index 42068a1..3cfbaea 100644 --- a/src/Deblan/Console/Application.php +++ b/src/Deblan/Console/Application.php @@ -6,6 +6,7 @@ use ReflectionException; use ReflectionClass; use Symfony\Component\Console\Application as BaseApplication; use Symfony\Component\Finder\Finder; +use Propel\Runtime\Propel; class Application extends BaseApplication { @@ -25,6 +26,11 @@ class Application extends BaseApplication return $this; } + public function initPropel() + { + Propel::init('app/propel/config.php'); + } + public function loadCommands() { foreach ($this->commandsPaths as $path => $namespace) { @@ -45,7 +51,7 @@ class Application extends BaseApplication )); } } catch (ReflectionException $e) { - + } } }