Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model/BaseModel - Fix primary key and add @throws for builder method #4071

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1675,13 +1675,6 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur
if (method_exists($data, 'toRawArray'))
{
$properties = $data->toRawArray($onlyChanged, $recursive);

// Always grab the primary key otherwise updates will fail.
if (! empty($properties) && ! empty($this->primaryKey) && ! in_array($this->primaryKey, $properties, true)
&& ! empty($data->{$this->primaryKey}))
{
$properties[$this->primaryKey] = $data->{$this->primaryKey};
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ public function countAllResults(bool $reset = true, bool $test = false)
* @param string|null $table Table name
*
* @return BaseBuilder
* @throws ModelException
*/
public function builder(?string $table = null)
{
Expand Down