0
votes

Can someone please help me with this error.

Type error: Argument 1 passed to Twig_Extensions_Extension_Date::__construct() must implement interface Symfony\Component\Translation\TranslatorInterface, instance of VojtaSvoboda\TwigExtensions\Classes\TimeDiffTranslator given, called in plugins\vojtasvoboda\twigextensions\

All I know from this message is that the getTimeFilter method in vojtasvoboda\twigextensions\Plugin.php is passing a parameter of type 'time_diff_traslator' but the required type is TranslatorInterface.

$translator = $this->app->make('time_diff_translator'); $timeExtension = new Twig_Extensions_Extension_Date($translator);

Below is the constructor for Twig_Extensions_Extension_Date and you can see its taking a parameter of type TranslatorInterface but Plugin.php is passing a different parameter. /** * @var TranslatorInterface */ private $translator;

public function __construct(TranslatorInterface $translator = null)
{
    $this->translator = $translator;
}

/**
 * {@inheritdoc}
1
Please add some details about your problem. Where does this error occur? What have you done to produce it? What have you already tried in order to solve it? - Daniel K.
As soon as I type "php artisan serve" and go to localhost I get this as an error. I am new to OctoberCMS so please help me. - Amrut 2017

1 Answers

0
votes

I would suggest to update your plugin as in old version you can see in git diff , they are not implemented interface (https://github.com/vojtasvoboda/oc-twigextensions-plugin/commit/e6feb178d40ee0d000d0a6f7d2462d6d70e4194e#diff-325d760197f3aac320381cc8ddd52660)

in new version they have implemented proper interface so with new version it should work.

Old code in repo

class TimeDiffTranslator extends Translator

New code in repo

...
use Symfony\Component\Translation\TranslatorInterface;
...           
TimeDiffTranslator extends Translator implements TranslatorInterface

so if you update your extension with new code TimeDiffTranslator is type of TranslatorInterface and constructor will accept it, use direct October cms back-end or use git repository to update your plugin.

Update


Please follow given screen shot and you can update your october cms version as well all plugins (make sure you didn't do any core changes as well market place plugin changes as this update will override them)

go to settings - plugin and updates image1

check for update image2

apply update iamge3

please let me know if its not working.