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

New Observe Attribute work has broken my model #50284

Closed
TheFrankman opened this issue Feb 27, 2024 · 4 comments
Closed

New Observe Attribute work has broken my model #50284

TheFrankman opened this issue Feb 27, 2024 · 4 comments

Comments

@TheFrankman
Copy link

Laravel Version

10.45.1

PHP Version

8.1.2

Database Driver & Version

MariaDB 10.x

Description

Latest update has broken models with custom constructs.

Steps To Reproduce

 "class": "ArgumentCountError",
    "message": "Too few arguments to function App\\Models\\TimbrePlayer::__construct(), 0 passed in /var/www/timbre/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php on line 67 and at least 2 expected",
    "code": 0,
    "file": "/var/www/timbre/app/Models/TimbrePlayer.php:28",
    "trace": [

I have a model that that has a custom construct :

   public function __construct(
        Customer $customer,
        string $assetUuid,
        string $type = 'item',
        ?string $mount = null,
        ?CustomEmbedTheme $defaultCustomerEmbedTheme = null
    ) {
        parent::__construct();
        $this->customer = $customer;
        $this->assetUuid = $assetUuid;
        $this->type = $type;
        $this->mount = $mount;
        $this->defaultEmbedTheme = $defaultCustomerEmbedTheme;
    }

I believe the new auto discovery work is at fault here. I haven't done a full investigation yet, i will update as I go but fairly confident it's related to this PR : #49843

@driesvints
Copy link
Member

I have a model that that has a custom construct :

I'm sorry but we do not recommend or support usage of models with custom constructs and strongly advice against this.

@matin-kh73
Copy link

@TheFrankman
This may help you #50295

@Disservin
Copy link

I have a model that that has a custom construct :

I'm sorry but we do not recommend or support usage of models with custom constructs and strongly advice against this.

@driesvints Is this documented anywhere?

@driesvints
Copy link
Member

@Disservin not sure. If it isn't, we welcome PRs.

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

No branches or pull requests

4 participants