Skip to content

Commit

Permalink
[Command] Autoload Propel commands
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Dec 22, 2011
1 parent 16d77be commit 97125c6
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions bin/propel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 97125c6

Please sign in to comment.