Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Command] Autoload Propel commands

  • Loading branch information...
commit 97125c6b5a0f750e88b841d6eb86b7be8e4428eb 1 parent 16d77be
@willdurand willdurand authored
Showing with 17 additions and 5 deletions.
  1. +17 −5 bin/propel.php
View
22 bin/propel.php
@@ -8,10 +8,22 @@
}
}
-use \Symfony\Component\Console\Application;
+use Symfony\Component\Console\Application;
+use Symfony\Component\Finder\Finder;
+
+use Propel\Runtime\Propel;
+
+$finder = new Finder();
+$finder->files()->name('*.php')->in(__DIR__.'/../src/Propel/Generator/Command');
+
+$app = new Application('Propel', Propel::VERSION);
+
+foreach ($finder as $file) {
+ $ns = '\\Propel\\Generator\\Command';
+ $r = new \ReflectionClass($ns.'\\'.$file->getBasename('.php'));
+ if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract()) {
+ $app->add($r->newInstance());
+ }
+}
-$app = new Application('Propel', '2.0 (dev)');
-$app->add(new \Propel\Generator\Command\TestPrepare());
-$app->add(new \Propel\Generator\Command\SqlBuild());
-$app->add(new \Propel\Generator\Command\ModelBuild());
$app->run();
Please sign in to comment.
Something went wrong with that request. Please try again.