2017-07-26 92 views
0

我試圖使用FosCommentBundle來Symfony3。FosCommentBundle Symfony3的資產異常

我完成了與documentation of bundle一起安裝的所有步驟。

我添加了AppKernel的信息並創建了數據庫,更新了模式並添加了Jquery3。

但是,當我嘗試檢查index.html.twig它給出了以下錯誤。

There is no extension able to load the configuration for "assetic" (in C:\xampp\htdocs\blogbundle\app/config\config.yml). Looked for namespace "assetic", found "framework", "security", "twig", "monolog", "swiftmailer", "doctrine", "sensio_framework_extra", "fos_rest", "fos_comment", "jms_serializer", "debug", "web_profiler", "sensio_distribution", "web_server" in C:\xampp\htdocs\blogbundle\app/config\config.yml (which is being imported from "C:\xampp\htdocs\blogbundle\app/config/config_dev.yml"). 

我config.yml

fos_comment: 
    db_driver: orm 
    class: 
     model: 
      comment: AppBundle\Entity\Comment 
      thread: AppBundle\Entity\Thread 

assetic: 
    bundles: [ "FOSCommentBundle" ] 

的routing.yml

app: 
    resource: '@AppBundle/Controller/' 
    type: annotation 

fos_comment_api: 
    type: rest 
    resource: "@FOSCommentBundle/Resources/config/routing.yml" 
    prefix: /api 
    defaults: { _format: html } 

實體: - Comment.php

<?php 

namespace AppBundle\Entity; 

use Doctrine\ORM\Mapping as ORM; 
use FOS\CommentBundle\Entity\Comment as BaseComment; 

/** 
* @ORM\Entity 
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") 
*/ 
class Comment extends BaseComment 
{ 
    /** 
    * @ORM\Id 
    * @ORM\Column(type="integer") 
    * @ORM\GeneratedValue(strategy="AUTO") 
    */ 
    protected $id; 

    /** 
    * Thread of this comment 
    * 
    * @var Thread 
    * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Thread") 
    */ 
    protected $thread; 
} 

Thread.php

<?php 

namespace AppBundle\Entity; 


use Doctrine\ORM\Mapping as ORM; 
use FOS\CommentBundle\Entity\Thread as BaseThread; 

/** 
* @ORM\Entity 
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") 
*/ 
class Thread extends BaseThread 
{ 
    /** 
    * @var string $id 
    * 
    * @ORM\Id 
    * @ORM\Column(type="string") 
    */ 
    protected $id; 
} 

回答

0

您只需安裝資產包即可。

作曲家需要的symfony/assetic束 然後在appkernel

新的Symfony \捆綁\ AsseticBundle \ AsseticBundle()將其添加到registerBundles,

和將此添加到config.yml中

assetic: 
    debug:   '%kernel.debug%' 
    use_controller: '%kernel.debug%' 
    filters: 
     cssrewrite: ~