Skip to content

Commit

Permalink
Fixed issues after a rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed May 24, 2019
1 parent 74e75bb commit 1f2f6bb
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ protected function _getPortableViewsList(array $views) : array
*/
protected function _getPortableViewDefinition(array $view) : View
{
throw DBALException::notSupported('Views');
throw NotSupported::new('Views');
}

/**
Expand Down
25 changes: 25 additions & 0 deletions lib/Doctrine/DBAL/Schema/Exception/NamedIndexRequired.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Schema\Exception;

use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Schema\Table;
use function implode;
use function sprintf;

final class NamedIndexRequired extends SchemaException
{
public static function new(Table $table, Index $index) : self
{
return new self(
sprintf(
'The performed schema operation on %s requires a named index, but the given index on (%s) is currently unnamed.',
$table->getName(),
implode(', ', $index->getColumns())
)
);
}
}
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use function preg_replace;
use function rtrim;
use function sprintf;
use function str_replace;
use function strpos;
use function strtolower;
use function trim;
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Exception\NamedForeignKeyRequired;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
use SplObjectStorage;
Expand Down Expand Up @@ -49,7 +48,7 @@ public function acceptTable(Table $table) : void
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void
{
if ($fkConstraint->getName() === null) {
throw SchemaException::namedForeignKeyRequired($localTable, $fkConstraint);
throw NamedForeignKeyRequired::new($localTable, $fkConstraint);
}

$this->constraints->attach($fkConstraint, $localTable);
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\DBAL\Schema\Visitor;

use Doctrine\DBAL\Schema\Exception\NamedForeignKeyRequired;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
Expand Down Expand Up @@ -90,7 +91,7 @@ private function removeForeignKey(Table $table, ForeignKeyConstraint $constraint
$name = $constraint->getName();

if ($name === null) {
throw SchemaException::namedForeignKeyRequired($table, $constraint);
throw NamedForeignKeyRequired::new($table, $constraint);
}

$table->removeForeignKey($name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\DBAL\Sharding\SQLAzure\Schema;

use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Exception\NamedIndexRequired;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Schema;
Expand Down Expand Up @@ -91,7 +92,7 @@ public function acceptTable(Table $table) : void
$name = $clusteredIndex->getName();

if ($name === null) {
throw SchemaException::namedIndexRequired($table, $clusteredIndex);
throw NamedIndexRequired::new($table, $clusteredIndex);
}

$table->dropIndex($name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ protected function setUp() : void
}

/**
* @param mixed $expectedDefault
*
* @dataProvider columnProvider
*/
public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $expectedDefault) : void
Expand All @@ -55,6 +57,8 @@ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $
}

/**
* @param mixed $expectedDefault
*
* @dataProvider columnProvider
*/
public function testEscapedDefaultValueCanBeInserted(string $name, ?string $expectedDefault) : void
Expand Down

0 comments on commit 1f2f6bb

Please sign in to comment.