We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8aca0c7 commit 5d3ae78Copy full SHA for 5d3ae78
src/Scheme/TableScheme.php
@@ -5,6 +5,7 @@
5
namespace Evas\Orm\Scheme;
6
7
use Evas\Orm\Base\Database;
8
+use Evas\Orm\OrmException;
9
use Evas\Orm\Scheme\ColumnScheme;
10
use Evas\Orm\Scheme\Exception\NotFoundColumnException;
11
@@ -61,6 +62,9 @@ public function primaryKey(): string
61
62
$row = $this->database->query("SHOW KEYS FROM `$this->table` WHERE Key_name = 'PRIMARY'")->assocArray();
63
$this->primaryKey = $row['Column_name'];
64
}
65
+ if (empty($this->primaryKey)) {
66
+ throw new OrmException("Primary key does not exist in table \"$this->table\"");
67
+ }
68
return $this->primaryKey;
69
70
0 commit comments