2016-07-30 79 views
1

我嘗試symfony3使用的CKEditor,我安裝成功,但是當我試圖使我們在我的形式在教程中所描述得到一個錯誤(https://symfony.com/doc/current/bundles/IvoryCKEditorBundle/index.html):使用的CKEditor在symfony3

$builder->add('content', CKEditorType::class); 

但產生這個錯誤:

Type error: Argument 1 passed to Ivory\CKEditorBundle\Form\Type\CKEditorType::__construct() must be an instance of Ivory\CKEditorBundle\Model\ConfigManagerInterface, none given

它看起來像,有一個問題,因爲在其構造FormType不應要求參數,可以是我錯了嗎?

+0

這似乎是IvoryCKEditorBundle中的一個錯誤。 – felipsmartins

+0

@felipsmartins不是。 – mblaettermann

回答

1

我有同樣的錯誤,並通過添加CKEditorBundle到AppKernel解決了這個問題。 這是在CountZero's答案的評論中陳述的。你可以找到IvoryCKEditorBundle安裝說明here

class AppKernel extends Kernel 
{ 
    public function registerBundles() 
    { 
     $bundles = array(
      new Ivory\CKEditorBundle\IvoryCKEditorBundle(), 
      // ... 
     ); 

     // ... 
    } 
} 
1

IvoryCKEditorBundle中沒有錯誤。如果你提供你的composer.json,命令bin/console debug:containerbin/console config IvoryCKEditorBundle的結果會幫助我給你更準確的答案。

it looks like, there is a problem because a FormType should not demand params in its constructor, am I wrong?

您錯了,CKEditorType可能會在其構造函數中要求params,並且它在當前版本中會這樣做。 文件有問題vendor/egeloen/ckeditor-bundle/Resources/config/form.xml 它應該爲CKEditorBundle配置(提供)服務依賴關係,但事實並非如此。

我會嘗試更新作曲家,清除緩存和調試服務容器配置對於這種捆綁,它應該是這樣的:

⇒ composer update 
⇒ bin/console cache:clear 
⇒ bin/console debug:container|grep ivory  
    ivory_ck_editor.config_manager          Ivory\CKEditorBundle\Model\ConfigManager              
    ivory_ck_editor.form.type           Ivory\CKEditorBundle\Form\Type\CKEditorType             
    ivory_ck_editor.plugin_manager          Ivory\CKEditorBundle\Model\PluginManager              
    ivory_ck_editor.renderer            Ivory\CKEditorBundle\Renderer\CKEditorRenderer            
    ivory_ck_editor.styles_set_manager         Ivory\CKEditorBundle\Model\StylesSetManager             
    ivory_ck_editor.template_manager          Ivory\CKEditorBundle\Model\TemplateManager             
    ivory_ck_editor.twig_extension          Ivory\CKEditorBundle\Twig\CKEditorExtension 
+2

是的,對我來說,它看起來像OP已經忘記將CKEditorBundle包含到AppKernel裏 – mblaettermann

+0

@mblaettermann你是對的!我再次檢查了一遍,我沒有忘記,但在另一個項目中改變了appkernel,doh。謝謝。順便說一句,我喜歡這句話:「IvoryCKEditorBundle沒有錯誤。」 :) – Asara

+0

如果你們其中一個人作出回答(檢查appkernel),我會將其標記爲解決方案 – Asara