Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@ final class Command extends AbstractPdoCommand
ColumnType::BIGINT,
];

public function insertReturningPks(string $table, array|QueryInterface $columns): array|false
public function insertReturningPks(string $table, array|QueryInterface $columns): array
{
$tableSchema = $this->db->getSchema()->getTableSchema($table);
$returnColumns = $tableSchema?->getPrimaryKey() ?? [];

if ($returnColumns === []) {
if ($this->insert($table, $columns)->execute() === 0) {
return false;
}

$this->insert($table, $columns)->execute();
return [];
}
/** @var TableSchema $tableSchema */
Expand Down Expand Up @@ -97,9 +94,7 @@ public function insertReturningPks(string $table, array|QueryInterface $columns)

unset($value);

if ($this->execute() === 0) {
return false;
}
$this->execute();

$result = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ protected function loadTableIndexes(string $tableName): array
$columnNames = [];
}

/** @var string[] $columnNames */
/** @var list<string> $columnNames */
$result[$name] = new Index(
$name,
$columnNames,
Expand Down
Loading