Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved migrations-specific method out of DoctrineBundle\Command\Doctri…
…neCommand and into the migrations bundle.
- Loading branch information
Showing
8 changed files
with
44 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Symfony/Framework/DoctrineMigrationsBundle/Command/DoctrineCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Symfony\Framework\DoctrineMigrationsBundle\Command; | ||
|
||
use Symfony\Framework\WebBundle\Console\Application; | ||
use Symfony\Framework\DoctrineBundle\Command\DoctrineCommand as BaseCommand; | ||
use Doctrine\DBAL\Migrations\Configuration\Configuration; | ||
use Doctrine\Common\Util\Inflector; | ||
|
||
/* | ||
* This file is part of the Symfony framework. | ||
* | ||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
/** | ||
* Base class for Doctrine console commands to extend from. | ||
* | ||
* @package Symfony | ||
* @subpackage Framework_DoctrineBundle | ||
* @author Fabien Potencier <fabien.potencier@symfony-project.com> | ||
*/ | ||
abstract class DoctrineCommand extends BaseCommand | ||
{ | ||
public static function configureMigrationsForBundle(Application $application, $bundle, Configuration $configuration) | ||
{ | ||
$configuration->setMigrationsNamespace($bundle.'\DoctrineMigrations'); | ||
|
||
$dirs = $application->getKernel()->getBundleDirs(); | ||
|
||
$tmp = str_replace('\\', '/', $bundle); | ||
$namespace = str_replace('/', '\\', dirname($tmp)); | ||
$bundle = basename($tmp); | ||
|
||
$dir = $dirs[$namespace].'/'.$bundle.'/DoctrineMigrations'; | ||
$configuration->setMigrationsDirectory($dir); | ||
$configuration->registerMigrationsFromDirectory($dir); | ||
$configuration->setName($bundle.' Migrations'); | ||
$configuration->setMigrationsTableName(Inflector::tableize($bundle).'_migration_versions'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters