简体   繁体   English

Symfony2服务参数构造函数错误

[英]Symfony2 service param constructor error

I am using symfony2 and I use one service to notify my users based in some action sof the system. 我正在使用symfony2,并且使用一种服务来根据系统的某些操作通知我的用户。 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: 该服务在services.txt上的名称为:

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. 我尝试做的第一件事是更改构造函数以解决该问题……浏览器出现500错误,因此我改了回去。

使用Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface键入第二个参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM