Skip to content

Commit e67d29f

Browse files
authored
Merge pull request #4071 from najdanovicivan/nosql/base-model-fix
Model/BaseModel - Fix primary key and add @throws for builder method
2 parents c5adf56 + b01cb98 commit e67d29f

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

system/BaseModel.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,13 +1675,6 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur
16751675
if (method_exists($data, 'toRawArray'))
16761676
{
16771677
$properties = $data->toRawArray($onlyChanged, $recursive);
1678-
1679-
// Always grab the primary key otherwise updates will fail.
1680-
if (! empty($properties) && ! empty($this->primaryKey) && ! in_array($this->primaryKey, $properties, true)
1681-
&& ! empty($data->{$this->primaryKey}))
1682-
{
1683-
$properties[$this->primaryKey] = $data->{$this->primaryKey};
1684-
}
16851678
}
16861679
else
16871680
{

system/Model.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ public function countAllResults(bool $reset = true, bool $test = false)
560560
* @param string|null $table Table name
561561
*
562562
* @return BaseBuilder
563+
* @throws ModelException
563564
*/
564565
public function builder(?string $table = null)
565566
{

0 commit comments

Comments
 (0)