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

[Bug]: Call to undefined method App\Contexts\MethodCall::isAutoCompleting() #108

Open
nissicreative opened this issue Dec 20, 2024 · 0 comments
Assignees
Labels

Comments

@nissicreative
Copy link

Extension Version

0.1.14

PHP Binary

Herd

Operating System

macOS

What happened?

I get this error when trying to use a dynamically-defined Mailable. Not sure if it's a bug or just an anomaly.

2024-12-20 11:03:39.357 [error] 
In Arguments.php line 15:
                                                                        
  Call to undefined method App\Contexts\MethodCall::isAutoCompleting()

Mimimal Code Sample

<?php

namespace App\Actions;

use App\Models\Contact;
use App\Models\DripMail;
use App\Models\User;
use Illuminate\Support\Facades\Mail;

class SendDripMail
{
    public function __construct(
        readonly DripMail $dripMail,
    ) {}

    public function handle(
        Contact $contact,
        User $csr,
    ) {
        // The DripMail model stores a Mailable class name as a string
        // e.g., 'App\Mail\WelcomeMail'

        // Extracting the mailable class name from the DripMail model
        // and creating a new instance of the mailable class is fine...
        $mailableClass = $this->dripMail->mailable;
        $mailable = new $mailableClass(contact: $contact, csr: $csr);

        // ...but this way causes the error in the Laravel VS Code extension 👇
        $mailable = new $this->dripMail->mailable(contact: $contact, csr: $csr);

        Mail::to($contact)->queue($mailable);

        // As does this way 👇
        Mail::to($contact)->queue(new $this->dripMail->mailable(contact: $contact, csr: $csr));
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants