Error: Class "MailjetTools\MailjetApi" not found in Drupal\mailjet\Form\MailjetApiForm->submitForm()

Created on 30 July 2024, 8 months ago

Problem/Motivation

I'm finding this issue when I try to save the configurations on the API page (/admin/config/system/mailjet/api): "Error: Class "MailjetTools\MailjetApi" not found in Drupal\mailjet\Form\MailjetApiForm->submitForm() (line 97 of /var/www/html/web/modules/contrib/mailjet/src/Form/MailjetApiForm.php)"

Steps to reproduce

  • Go to /admin/config/system/mailjet/api
  • Enter an Api Key and a Secret key
  • Save the configurations

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hemgar
  • 🇫🇷France bachbach Le Havre

    here is a patch

  • Status changed to RTBC 7 months ago
  • 🇨🇴Colombia aldibier Manizales

    This patch works perfectly,

    Thank you,

  • Status changed to Needs work 4 months ago
  • 🇮🇳India prashant.c Dharamshala

    This is not the correct way to fix this. Because this is a library downloaded by the composer mailjet/mailjet-apiv3-php

    We need to add the following to the composer.json file

    "MailjetTools\\": "docroot/modules/contrib/mailjet/lib/mailjet-api-php/"

    in the section

     "autoload-dev": {
            "psr-4": {
                "Drupal\\Tests\\PHPUnit\\": "tests/phpunit/src/",
                "MailjetTools\\": "docroot/modules/contrib/mailjet/lib/mailjet-api-php/"
            }
        },

    Then refresh the autoload path by executing the command

    composer dump-autoload
    

    This should fix the error.

Production build 0.71.5 2024