Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Re-added support for Doctrine 2.1

  • Loading branch information...
commit 3dd738b2a709f4d5185c144292189c6e708ca37d 1 parent c776e06
@stof stof authored
View
10 lib/Doctrine/DBAL/Migrations/Tools/Console/Command/DiffCommand.php
@@ -24,6 +24,7 @@
Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Doctrine\ORM\Tools\SchemaTool,
+ Doctrine\DBAL\Version as DbalVersion,
Doctrine\DBAL\Migrations\Configuration\Configuration;
/**
@@ -59,6 +60,7 @@ protected function configure()
public function execute(InputInterface $input, OutputInterface $output)
{
+ $isDbalOld = (DbalVersion::compare('2.2.0') > 0);
$configuration = $this->getMigrationConfiguration($input, $output);
$em = $this->getHelper('em')->getEntityManager();
@@ -72,17 +74,21 @@ public function execute(InputInterface $input, OutputInterface $output)
}
if ($filterExpr = $input->getOption('filter-expression')) {
+ if ($isDbalOld) {
+ throw new \InvalidArgumentException('The "--filter-expression" option can only be used as of Doctrine DBAL 2.2');
+ }
+
$conn->getConfiguration()
->setFilterSchemaAssetsExpression($filterExpr);
}
-
+
$tool = new SchemaTool($em);
$fromSchema = $conn->getSchemaManager()->createSchema();
$toSchema = $tool->getSchemaFromMetadata($metadata);
//Not using value from options, because filters can be set from config.yml
- if ($filterExpr = $conn->getConfiguration()->getFilterSchemaAssetsExpression()) {
+ if ( ! $isDbalOld && $filterExpr = $conn->getConfiguration()->getFilterSchemaAssetsExpression()) {
$tableNames = $toSchema->getTableNames();
foreach ($tableNames as $tableName) {
$tableName = substr($tableName, strpos($tableName, '.') + 1);
Please sign in to comment.
Something went wrong with that request. Please try again.