2016-04-28 20 views
0

非実在のキャッシュファイルをロードするための試みを引き起こしているようだ。このようなアプリケーションファイルに登録されて小枝の拡張子は、私はサイレックス・ベースのサイトのために、この小枝の拡張子を持つ

<?php 
namespace UT\Provider; 

/** 
* Twig extension for containing any additional twig functions we need 
*/ 
class TwigUTProvider extends \Twig_Extension { 

    public function getName() { 
     return 'ut_functions'; 
    } 

    public function getFunctions() { 
     return [ 
      new \Twig_SimpleFunction("maybeDecodeJapanse", [$this, \UT\Provider\TwigUTProvider::maybeDecodeJapanse()]), 
     ]; 
    } 

    public function maybeDecodeJapanse() { 
     return 'a string'; 
    } 
} 

$this->register(new Provider\TwigServiceProvider, [ 
      'twig.path' => [ 
       __DIR__ . '/Resources/Templates', 
       $this['docroot'] . '/silex/vendor/braincrafted/bootstrap-bundle/Braincrafted/Bundle/BootstrapBundle/Resources/views/Form', 
       __DIR__ . '/../Floso/Templates', 
      ], 
      'twig.options' => [ 
       'auto_reload' => true, 
       'cache' => $this['debug_mode'] ? false : ($this['docroot'] . '/silex/var/cache/twig'), 
       'debug' => $this['debug_mode'], 
      ], 
     ]); 

     # Add Twig extensions 
     $this['twig'] = $this->share($this->extend('twig', function ($twig) { 
      $twig->addExtension(new \UT\Provider\TwigUTProvider()); 
      $twig->addExtension(new BootstrapBundle\Twig\BootstrapIconExtension('glyphicon')); 
      $twig->addExtension(new BootstrapBundle\Twig\BootstrapLabelExtension); 
      $twig->addExtension(new BootstrapBundle\Twig\BootstrapBadgeExtension); 
      $twig->addExtension(new BootstrapBundle\Twig\BootstrapFormExtension); 
      $twig->addExtension(new \Twig_Extension_StringLoader()); 

      $twig->getExtension('core')->setTimezone('Europe/London'); 

      return $twig; 
     })); 

これは正しいようです - 拡張クラス名に間違った挿入があると、別の例外が発生します。

私は(それが例外を見つけていない標準関数を生成mispelling、自分自身を呼び出すテンプレートによって引き起こされていないようです)この例外が発生し{{ maybeDecodeJapanese() }}、と私の小枝テンプレートでこの拡張機能を呼び出す:

Class '__TwigTemplate_3318c38dfd9c3eb0c4193184a517ff94fdd975ffb45d7f0a8f7490718f3bc1ef' not found 

これは/silex/vendor/twig/twig/lib/Twig/Environment.phpにあります

これは何らかの種類のキャッシュファイルです。キャッシュはdev環境では無効になっていますが、キャッシュフォルダの内容を削除しようとしましたが、これは役に立たなかったのです。グーグルはまだ他のリードを提供していない。

問題の原因を特定する助けがあれば非常に役に立ちます。

+0

「Japanse」に「e」が入っていない可能性があります。 –

答えて

2

機能定義に誤りがあると思います。

...new \Twig_SimpleFunction("maybeDecodeJapanse", [$this, "maybeDecodeJapanse"]),... 
+0

それは動作します!これは午後すべて私を怒らせてしまった。ありがとう! –

関連する問題