Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ain/4453904 to your computer and use it in GitHub Desktop.
Save ain/4453904 to your computer and use it in GitHub Desktop.
<?php
/**
* Displays the current migration version of the database
*
* @version 1.0
* @author Ain Tohvri <at@interactive-pioneers.de>
* @see sfBaseTask
*/
class currentMigrationVersionTask extends sfBaseTask
{
protected function configure()
{
$this->addOptions(array(
new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'),
));
$this->namespace = 'doctrine';
$this->name = 'current-migration-version';
$this->briefDescription = 'Display current migration version';
$this->detailedDescription = <<<EOF
The [current-migration-version|INFO] displays the version of the current migration.
Call it with:
[php symfony doctrine:current-migration-version|INFO]
EOF;
}
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$migration = new Doctrine_Migration(dirname(__FILE__));
$this->logSection($this->name, $migration->getCurrentVersion());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment