繁体   English   中英

Symfony2服务参数构造函数错误

[英]Symfony2 service param constructor error

我正在使用symfony2,并且使用一种服务来根据系统的某些操作通知我的用户。 好吧,它在我的本地环境中工作得很好,现在在生产中我遇到了一些问题。

该服务在services.txt上的名称为:

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

并且该类被声明为

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

我收到此错误:

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

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

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

暂无
暂无

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

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