mailjet/mailjet-apiv3-php

Call to undefined method Mailjet\LaravelMailjet\Model\Contact::setProperties()

ValCanBuild opened this issue · 1 comments

I'm trying to use the ContactListService.updateEmail() method to update the emails of users on my list. But since updating to Laravel 9 and the the latest client version (3.0.2) this is failing each time with the error:

Call to undefined method Mailjet\LaravelMailjet\Model\Contact::setProperties() It's failing on in this part

    public function updateEmail(string $id, Contact $contact, string $oldEmail): array
    {
        $response = $this->mailjet->get(Resources::$Contactdata, ['id' => $oldEmail]);

        if (! $response->success()) {
            throw new MailjetException(0, 'ContactsListService:changeEmail() failed', $response);
        }

        $oldContactData = $response->getData();

        if (isset($oldContactData[0])) {
            $contact->setProperties($oldContactData[0]['Data']);
        }
        ....
}

When I look at the Contact model and it looks like it doesn't have a setProperties method so this error makes sense. Perhaps it needs to be setOptionalProperties instead?

Seems like a bug in the code that needs fixed?

Apologies, meant to raise this on the laravel-mailjet repo: mailjet/laravel-mailjet#60