2012-11-01 43 views
2

我正在使用symfony2,並且我使用一個服務來通知我的用戶在某些操作中基於系統。那麼,它在我的本地環境中工作得很好,現在在生產中我遇到了一些問題。Symfony2服務參數構造函數錯誤

的服務dlecared上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錯誤,所以我改回了。

+0

你在構造函數中改變了什麼? TimedTwigEngine到TwigEngine? –

回答

4

鍵入提示第二個參數Symfony\Bundle\FrameworkBundle\Templating\EngineInterface

+0

謝謝!剛剛解決了我的問題!現在我只想弄清楚爲什麼我在這兩種環境中有這種差異。 – PedroHCan