Skip to content

Commit

Permalink
if we don't have any primary keys, throw an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyTsalkov committed Jul 27, 2024
1 parent ecaf5c0 commit 240578d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions orm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ private function _dirtyfields($fields) {
protected function _whereHash() {
$hash = [];
$primary_keys = static::_orm_struct()->primary_keys();
if (! $primary_keys) {
throw new MeekroORMException("$this has no primary keys");
}
foreach ($primary_keys as $key) {
$hash[$key] = $this->getraw($key);
}
Expand Down

0 comments on commit 240578d

Please sign in to comment.