Skip to content

Commit

Permalink
refactor: remove if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Nov 27, 2023
1 parent 3b943d9 commit 3ca0768
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -812,19 +812,16 @@ protected function objectToRawArray($object, bool $onlyChanged = true, bool $rec

// Restore Entity casting setting.
$object->cast($cast);
}

// Always grab the primary key otherwise updates will fail.
if (
$object instanceof Entity
&& (
// Always grab the primary key otherwise updates will fail.
if (
! empty($properties)
&& ! empty($this->primaryKey)
&& ! in_array($this->primaryKey, $properties, true)
&& ! empty($primaryKey)
)
) {
$properties[$this->primaryKey] = $primaryKey;
) {
$properties[$this->primaryKey] = $primaryKey;
}
}

return $properties;
Expand Down

0 comments on commit 3ca0768

Please sign in to comment.