代码之家  ›  专栏  ›  技术社区  ›  onurkaya

Symfony3的FosCommentBundle资产异常

  •  0
  • onurkaya  · 技术社区  · 7 年前

    我正在尝试使用FosCommentBundle到Symfony3。

    documentation of bundle .

    我添加了AppKernel信息并创建了数据库,更新了模式并添加了Jquery3。

    但是当我尝试检查index.html时。它给出了以下错误。

    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").
    

    my config.yml

    fos_comment:
        db_driver: orm
        class:
            model:
                comment: AppBundle\Entity\Comment
                thread: AppBundle\Entity\Thread
    
    assetic:
        bundles: [ "FOSCommentBundle" ]
    

    路由.yml

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

    <?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;
    }
    

    <?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;
    }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Vinay Prajapati Mahfujur Rahman    7 年前

    您只需安装 .

    symfony/assetic束

    新建Symfony\Bundle\AsseticBundle\AsseticBundle(),

    并将其添加到config.yml中

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