1
votes

this code was working before in php 5.4, but after upgrading to php7 i get this error:

Type error: Argument 6 passed to dell\Bundle\dellbundles\ot\otdell::__construct() must be an instance of Symfony\Bundle\FrameworkBundle\Translation\Translator, instance of Symfony\Component\Translation\DataCollectorTranslator given, called in /var/www/dellprj/vendor/dfolder/dfolderbundles/dell/Bundle/otde/Controller/otdellController.php

code for otdellController.php:

 $translator = $this->get('translator');

 $myvar = new OtDell($this, $this->container, $viewParameters, $logger, $request, $translator);

means $translator is the problem. Anyway, here is the code for OtDell class:

 public function __construct(Controller $controller, ContainerInterface $container, array $viewParameters, LoggerInterface $logger, Request $request, Translator $translator)
    {......}

And here is the var_dump of $translator variable:

enter image description here

Thanks in advance.

1
In your constructor, use TranslatorInterface $translator instead of Translator $translatorTmb
Thanks for your comment, but the same problem.CrazyDeveloper
I've forgot to import(use) the TranslatorInterface so i added: use Symfony\Component\Translation\TranslatorInterface;CrazyDeveloper

1 Answers

0
votes

import the translator interface: use Symfony\Component\Translation\TranslatorInterface; Then In constructor, use TranslatorInterface $translator instead of Translator $translator.

Thanks @Thomas Mauduit-Blin