commit 4a5351c7cc09f936b3d9f49de8272624be58fcff
parent 0e7002d7bc55cc9c0d032576ba97a08c0f689ff5
Author: Timo A. Hummel <timo@idefix.timohummel.com>
Date: Tue, 5 Jul 2011 10:06:44 +0200
Added migrations (hopefully?)
Diffstat:
7 files changed, 61 insertions(+), 10 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -13,3 +13,6 @@
[submodule "frontend/resources/fugue-icons"]
path = frontend/resources/fugue-icons
url = git://github.com/yusukekamiyamane/fugue-icons.git
+[submodule "3rdparty/doctrine-migrations"]
+ path = 3rdparty/doctrine-migrations
+ url = git://github.com/doctrine/migrations.git
diff --git a/3rdparty/doctrine-migrations b/3rdparty/doctrine-migrations
@@ -0,0 +1 @@
+Subproject commit 652fed5124b16039b58f479c89e80e8e3188303b
diff --git a/cli-config.php b/cli-config.php
@@ -1,17 +1,28 @@
<?php
-use de\RaumZeitLabor\PartKeepr\Service\ServiceManager;
use de\RaumZeitLabor\PartKeepr\PartKeepr;
-use Doctrine\Common\ClassLoader;
-include("src/de/RaumZeitLabor/PartKeepr/PartKeepr.php");
-PartKeepr::initialize("");
+include_once("src/de/RaumZeitLabor/PartKeepr/PartKeepr.php");
+
+PartKeepr::initialize(""); // Classloaders are initialized here
$em = PartKeepr::getEM();
-$classes = PartKeepr::getEntityClasses();
+$classes = PartKeepr::getEntityClasses(); // Seems to be necessary for the doctrine CLI
+
+$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\Common\Version::VERSION);
+$cli->addCommands(array(
+ new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
+ new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
+ new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
+ new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
+ new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
+ new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()
+));
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
-));-
\ No newline at end of file
+));
+
+$cli->run();
diff --git a/migrations-db.php b/migrations-db.php
@@ -0,0 +1,6 @@
+<?php
+use de\RaumZeitLabor\PartKeepr\PartKeepr;
+
+include_once("cli-config.php");
+
+return PartKeepr::getEM()->getConnection()->getParams();
diff --git a/migrations.yml b/migrations.yml
@@ -0,0 +1,5 @@
+---
+name: PartKeepr Migrations
+migrations_namespace: PartKeepr\Migrations
+table_name: partkeepr_versions
+migrations_directory: src/de/RaumZeitLabor/PartKeepr/Migrations
diff --git a/src/de/RaumZeitLabor/PartKeepr/Migrations/Version20110705100524.php b/src/de/RaumZeitLabor/PartKeepr/Migrations/Version20110705100524.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace PartKeepr\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration,
+ Doctrine\DBAL\Schema\Schema;
+
+/**
+ * Auto-generated Migration: Please modify to your need!
+ */
+class Version20110705100524 extends AbstractMigration
+{
+ public function up(Schema $schema)
+ {
+ // this up() migration is autogenerated, please modify it to your needs
+
+ }
+
+ public function down(Schema $schema)
+ {
+ // this down() migration is autogenerated, please modify it to your needs
+
+ }
+}
diff --git a/src/de/RaumZeitLabor/PartKeepr/PartKeepr.php b/src/de/RaumZeitLabor/PartKeepr/PartKeepr.php
@@ -49,7 +49,10 @@ class PartKeepr {
$classLoader = new ClassLoader('Doctrine\ORM');
$classLoader->register(); // register on SPL autoload stack
-
+
+ $classLoader = new ClassLoader('Doctrine\DBAL\Migrations', dirname(dirname(dirname(dirname(__DIR__)))) ."/3rdparty/doctrine-migrations/lib");
+ $classLoader->register();
+
$classLoader = new ClassLoader('Doctrine\DBAL');
$classLoader->register(); // register on SPL autoload stack
@@ -243,4 +246,4 @@ class PartKeepr {
);
}
}
-?>-
\ No newline at end of file
+?>