Symfony 3 | FOSCommentBundle manage many Threads / Comments

561 Views Asked by At

I use FOSCommentBundle in my project, I already configured it with a thread and a comment class and this is working. But now I need to manage many types of thread and comment.

For example I have News with comments and I have Contents with comments. Of course, the news comments are different from content comments.

I don't know how to do it in the config.yml :

fos_comment:
    db_driver: orm
    class:
        model:
            comment: Project\MyBundle\Entity\News
            thread: Project\MyBundle\Entity\Comment

How can I add my other thread / comment type ? Or how can I manage this case ?

TY

1

There are 1 best solutions below

1
REDMAN On

In the template that you want to use FOSCommentBundle you have to put thi code:

{% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': 'foo'} %}

So in the part {'id':'foo'} you can put a different id for any thread you want, even a different thread for any news, for example

{% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': 'news'~news.id} %}