[PR #5551] Fatal error with empty primary key in table definition #9645

Closed
opened 2026-01-22 16:04:57 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/5551

State: closed
Merged: No


I'm using the DatabaseDriver but used setTables to add table information. This can result in the following error because the return value of Doctrine\DBAL\Schema\Table:getPrimaryKey can be null.

Fatal error: Call to a member function getColumns() on null in .../lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php on line 511

PS: While working on a test case I also figured out there is no test for a missing primary key in general.

**Original Pull Request:** https://github.com/doctrine/orm/pull/5551 **State:** closed **Merged:** No --- I'm using the `DatabaseDriver` but used `setTables` to add table information. This can result in the following error because the return value of `Doctrine\DBAL\Schema\Table:getPrimaryKey` can be `null`. ``` Fatal error: Call to a member function getColumns() on null in .../lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php on line 511 ``` PS: While working on a test case I also figured out there is no test for a missing primary key in general.
admin added the pull-request label 2026-01-22 16:04:57 +01:00
admin closed this issue 2026-01-22 16:04:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9645