Skip to content

Commit 672176b

Browse files
committed
wip|fix: Missing method in @internal class SchemaInformation
Relates: #20
1 parent da8329f commit 672176b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

Classes/PhpDataSet.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,21 @@ public function import(array $dataSet): void
3939
$tableDetails = $connection->getSchemaManager()->listTableDetails($tableName);
4040
} elseif (method_exists($connection, 'getSchemaInformation')) {
4141
// >= 13
42-
$tableDetails = $connection->getSchemaInformation()->introspectTable($tableName);
42+
$tableDetails = $connection->getSchemaInformation()->getTableInfo($tableName);
4343
} else {
4444
throw new RuntimeException('Could not check the schema for table: ' . $tableName, 1707144020);
4545
}
4646

4747
foreach ($records as $record) {
4848
$types = [];
4949
foreach (array_keys($record) as $columnName) {
50-
$types[] = $tableDetails->getColumn((string)$columnName)->getType()->getBindingType();
50+
$columnInfo = $tableDetails->getColumnInfo((string)$columnName);
51+
52+
if ($columnInfo === null) {
53+
throw new RuntimeException('Could not get info for column "' . $columnName . '" of table: ' . $tableName, 1760697878);
54+
}
55+
56+
$types[] = $columnInfo->getType()->getBindingType();
5157
}
5258

5359
$connection->insert($tableName, $record, $types);

Tests/Functional/ImportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function failsIfSqlError(): void
8282
$this->expectExceptionMessageMatches(
8383
'#Error for PHP data-set "' . __DIR__ . '/Fixtures/WithBrokenSql.php":'
8484
. PHP_EOL
85-
. 'There is no column with name .*none_existing_column.* on table .*pages.*\.#'
85+
. 'Could not get info for column "none_existing_column" of table: pages#'
8686
);
8787
$this->importPHPDataSet(__DIR__ . '/Fixtures/WithBrokenSql.php');
8888
}

0 commit comments

Comments
 (0)