Php FOSCommentBundle如何实现

Php FOSCommentBundle如何实现,php,symfony,foscommentbundle,Php,Symfony,Foscommentbundle,是否有一些例子来实现这一点?不要在我的页面上显示任何内容 {% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': 'foo'} %} 我不知道如何放置此代码以及将在我的页面上显示什么 {% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': 'foo'} %} 当我把它放在我的config.yml assetic: b

是否有一些例子来实现这一点?不要在我的页面上显示任何内容

{% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': 'foo'} %} 
我不知道如何放置此代码以及将在我的页面上显示什么

{% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': 'foo'} %} 
当我把它放在我的
config.yml

    assetic:
         bundles: [ "FOSCommentBundle" ]   
创建一个错误:

“fos_comment”下未识别的选项“assetic”

我的配置:

fos_评论: db_驱动程序:orm 类别: 型号: 注释:BackEndBundle\Entity\comment 线程:BackEndBundle\Entity\thread

资产:
bundle:[“FOSCommentBundle”]

我假设您已经配置了bundle并创建了如下所示的require类

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;
}
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;
}
fos_comment:
    db_driver: orm
    class:
        model:
            comment: AppBundle\Entity\Comment
            thread: AppBundle\Entity\Thread
还有像这样的Thread.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;
}
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;
}
fos_comment:
    db_driver: orm
    class:
        model:
            comment: AppBundle\Entity\Comment
            thread: AppBundle\Entity\Thread
在config.yml中,您现在将有如下内容

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;
}
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;
}
fos_comment:
    db_driver: orm
    class:
        model:
            comment: AppBundle\Entity\Comment
            thread: AppBundle\Entity\Thread
运行以下命令

doctrine:cache:clear-metadata
doctrine:schema:update --force
在此之后,数据库中将有实体的表 现在在模板的顶部包括这个

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
在此步骤后清除dev和prod缓存。
PS:我已经选择了ORM方法

谢谢您的编辑。每次指定一个问题这是获得快速帮助并让我们了解问题所在的最佳方式。您是否遵循了此指南?我从未使用过FOSCommentBundle,但从错误中可以看出,
assetic
otpion在
fos\u comment
扇区下不存在。您是否仔细检查了所有集成过程,以确保正确遵循文档?@AliNiaz是的,我遵循了github的所有文档,但没有成功:(您是否也在使用FOSUserBundle?谢谢。我更改了ORM评论中的一些错误,并按照您的步骤进行操作,现在它可以工作了。谢谢您的帮助,我真的很感激!我很高兴它对我有所帮助。