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

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

Closed
ValCanBuild opened this issue Jun 27, 2022 · 1 comment

Comments

@ValCanBuild
Copy link

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?

@oleksandr-mykhailenko
Copy link
Collaborator

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?

Thank you for this note. The bug was fixed and merged. Enjoy

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

2 participants