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

Does not work with soon to be released Mautic V5: ($translator) must be of type Symfony\Component\Translation\TranslatorInterface #45

Open
adiux opened this issue Feb 22, 2023 · 1 comment

Comments

@adiux
Copy link

adiux commented Feb 22, 2023

Error

[2023-02-22 17:28:56] mautic.CRITICAL: Uncaught PHP Exception TypeError: "MauticPlugin\MauticRecaptchaBundle\EventListener\FormSubscriber::__construct(): Argument #5 ($translator) must be of type Symfony\Component\Translation\TranslatorInterface, Mautic\CoreBundle\Translation\Translator given, called in /var/www/html/var/cache/dev/ContainerEfSedQs/getMautic_Recaptcha_EventListener_FormSubscriberService.php on line 9" at /var/www/html/plugins/MauticRecaptchaBundle/EventListener/FormSubscriber.php line 80 {"exception":"[object] (TypeError(code: 0): MauticPlugin\\MauticRecaptchaBundle\\EventListener\\FormSubscriber::__construct(): Argument #5 ($translator) must be of type Symfony\\Component\\Translation\\TranslatorInterface, Mautic\\CoreBundle\\Translation\\Translator given, called in /var/www/html/var/cache/dev/ContainerEfSedQs/getMautic_Recaptcha_EventListener_FormSubscriberService.php on line 9 at /var/www/html/plugins/MauticRecaptchaBundle/EventListener/FormSubscriber.php:80)
@TomJ1588
Copy link

Swap out
use Symfony\Component\Translation\TranslatorInterface
with
use Mautic\CoreBundle\Translation\Translator;

Then change the following:
` /**
* @var Translator
*/
private $translator;

/**
 * @var string|null
 */
private $version;

/**
 * @param EventDispatcherInterface $eventDispatcher
 * @param IntegrationHelper        $integrationHelper
 * @param RecaptchaClient          $recaptchaClient
 * @param LeadModel                $leadModel
 * @param Translator      $translator
 */
public function __construct(
    EventDispatcherInterface $eventDispatcher,
    IntegrationHelper $integrationHelper,
    RecaptchaClient $recaptchaClient,
    LeadModel $leadModel,
    Translator $translator
) {`

Changing TranslatorInterface to be Translator

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