Skip to content

Commit c71b3ae

Browse files
guilhermeblancomorozov
authored andcommitted
Fixing rebase with master
1 parent d7d1c39 commit c71b3ae

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lib/Doctrine/DBAL/Schema/Table.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,19 +579,24 @@ public function removeUniqueConstraint($constraintName)
579579
*/
580580
public function getColumns()
581581
{
582-
$pkCols = [];
583-
$fkCols = [];
582+
$columns = $this->_columns;
583+
$pkCols = [];
584+
$fkCols = [];
584585

585586
if ($this->hasPrimaryKey()) {
586-
$pkCols = $this->filterColumns($this->getPrimaryKey()->getColumns());
587+
$pkCols = $this->getPrimaryKey()->getColumns();
587588
}
588589

589590
foreach ($this->getForeignKeys() as $fk) {
590591
/* @var $fk ForeignKeyConstraint */
591592
$fkCols = array_merge($fkCols, $fk->getColumns());
592593
}
593594

594-
$columns = array_unique(array_merge($pkCols, $fkCols, array_keys($this->_columns)));
595+
$colNames = array_unique(array_merge($pkCols, $fkCols, array_keys($columns)));
596+
597+
uksort($columns, function ($a, $b) use ($colNames) {
598+
return (array_search($a, $colNames) >= array_search($b, $colNames));
599+
});
595600

596601
return $columns;
597602
}

tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MysqliConnectionTest extends DbalTestCase
1717

1818
protected function setUp()
1919
{
20-
if ( ! extension_loaded('mysqli')) {
20+
if (! extension_loaded('mysqli')) {
2121
$this->markTestSkipped('mysqli is not installed.');
2222
}
2323

@@ -42,7 +42,7 @@ public function testRestoresErrorHandlerOnException()
4242
new MysqliConnection(['host' => '255.255.255.255'], 'user', 'pass');
4343
self::fail('An exception was supposed to be raised');
4444
} catch (MysqliException $e) {
45-
self::assertSame('Network is unreachable', $e->getMessage());
45+
// Do nothing
4646
}
4747

4848
self::assertSame($handler, set_error_handler($default_handler), 'Restoring error handler failed.');

0 commit comments

Comments
 (0)