2

I am using symfony2 and I use one service to notify my users based in some action sof the system. Well, It worked pretty fine in my local environment, now in production I am having some issues.

The service is dlecared on services.txt as:

mybundle.notify:
    class: NC8Digital\CRMBundle\Services\Notify
    arguments: [ @doctrine.orm.entity_manager, @templating, @mailer ]

And the class is declared as

public function __construct(EntityManager $em, TimedTwigEngine $templating, \Swift_Mailer $mailer)

And I am receiving this error:

PHP Catchable fatal error:  Argument 2 passed to NC8Digital\\CRMBundle\\Services\\Notify::__construct() must be an instance of Symfony\\Bundle\\TwigBundle\\Debug\\TimedTwigEngine, instance of Symfony\\Bundle\\TwigBundle\\TwigEngine given, called in /mypath/app/cache/prod/appProdProjectContainer.php on line 367 and defined in /mypath/src/NC8Digital/CRMBundle/Services/Notify.php on line 43

First thing I tried was to change my constructor to solve the problem... got a 500 error on my browser, so I changed back.

1
  • What did you change in the constructor? TimedTwigEngine to TwigEngine? Commented Nov 1, 2012 at 2:55

1 Answer 1

4

Type-hint the second parameter with Symfony\Bundle\FrameworkBundle\Templating\EngineInterface.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks!!! just solved my problem! now I just will try to figure out why I had this diferrence on the two environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.