0

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

Aximem
  • 714
  • 8
  • 27

1 Answers1

0

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} %}
REDMAN
  • 91
  • 9
  • Hi @REDMAN, Thanks for your answer. I posted my question on the GitHub repo : https://github.com/FriendsOfSymfony/FOSCommentBundle/issues/567 and somebody answered me approximately the same answer. I have to use only one table with different id in function of comment type. For example I have to do one table "Comment" with a field "ThreadId" = news-1 / news-2 / content-1 / content-2 and that's not what I want. I really need two different comment tables, one with "NewsId" and the other one with "ContentId". I didn't find a way so I gave up weeks ago. TY – Aximem Oct 31 '16 at 16:21