Propel configuration and init

This commit is contained in:
Simon Vieille 2015-02-17 13:45:17 +01:00
parent c4871f6027
commit 5ce1a7d1e9
3 changed files with 39 additions and 2 deletions

View file

@ -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();;

31
propel.yaml Normal file
View file

@ -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]

View file

@ -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) {
}
}
}