I have AcmeBlogBundle:BlogPost entity and use FOSCommentBundle to comment it. All works fine, I just do:
{%
include 'FOSCommentBundle:Thread:async.html.twig'
with {'id': 'blogpost' ~ blogpost.id}
%}
And today I want to notify AcmeBlogBundle:BlogPost owner about new comments to his post. What is the best way to do this?
- I can save link to AcmeBlogBundle:BlogPost entity at AcmeBlogBundle:Thread (extends FOSCommentBundle:Thread) and then use it at thread persist events. But how can I save link, if Thread creates independently of BlogPost. And it's already not clean, because Thread will have dependency on BlogPost =(.
- I can store Thread id like blog_post_{id} and then parse it thread persist events =(.
- Store thread at BlogPost, but how I can to hook on creating Thread at concrete BlogPost.
And so on, and so on...
Sorry for my english, what is the best way to solve my problem?
UPD1: I have dupblicated question to https://github.com/FriendsOfSymfony/FOSCommentBundle/issues/367.
Here is an example on how to use the event dispatcher with FOSCommentBundle.