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

Custom settings can't be opened after update to October v3.3 and usage of new SettingModel #5712

Closed
tschortsch opened this issue Mar 27, 2023 · 2 comments

Comments

@tschortsch
Copy link

Hi,

After upgrading from October 3.2 to 3.3 and migrating our Plugin Settings from implementing the \System\Behaviors\SettingsModel::class to extend the SettingModel the page can't be opened anymore and throws the following error:

array_merge(): Argument #1 must be of type array, null given

in ~/vendor/october/rain/src/Database/ExpandoModel.php line 44
$this->attributes = array_merge($this->{$this->expandoColumn}, $this->attributes);

I guess this is happening because of our custom setting only has one relation field ($belongsToMany) and no other fields defined. I don't really know for what this ExpandoModel is for but I guess the following check in the expandoAfterFetch() function should fix the issue:

public function expandoAfterFetch()
 {
     if ($this->{$this->expandoColumn}) {
        $this->attributes = array_merge($this->{$this->expandoColumn}, $this->attributes);
     }
     $this->syncOriginal();
 }
@daftspunk
Copy link
Member

Hey @tschortsch

See if this change helps: octobercms/library@57cd623

@tschortsch
Copy link
Author

It does! Quick as always. 🥇 Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants