Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about FOSCommentBundle:Thread subscription? #367

Closed
krasun opened this issue May 16, 2013 · 5 comments
Closed

What about FOSCommentBundle:Thread subscription? #367

krasun opened this issue May 16, 2013 · 5 comments

Comments

@krasun
Copy link

krasun commented May 16, 2013

I try to ask this question on StackOverflow - http://stackoverflow.com/questions/16596778/what-is-the-best-way-to-notify-about-new-foscommentbundlecomment. But I think, here is more suitable place.

For example I have BlogPost that isn't assigned with Thread, and I listen on any new comment on this BlogPost entity. What is the best way to do this?

P.S. Thanks for your bundles!

@krasun
Copy link
Author

krasun commented May 17, 2013

Maybe I can attach thread owner to Thread entity on thread created event and listen to new comments events. Then create mail to thread owner.

But what if I want to other users to subscribe to this thread. Thread subscription suggests.

@krasun
Copy link
Author

krasun commented May 17, 2013

Sorry, but I have no time and today my dirty hack solution is https://gist.github.com/krasun/5599548.

@stof
Copy link
Member

stof commented May 17, 2013

@krasun instead of overwriting the method creating a thread to add the subscribers, you should use the event dispatched when saving the thread

@krasun
Copy link
Author

krasun commented May 17, 2013

@stof, I agree. But subscribers I take from another entities like blog post authors, product publishers and so on. And when I use listener I can't to know to what entity thread belongs. That's why I create thread in controller and use code like this:

$thread->addSubscriber($bookingRequest->getPlace()->getOwner()->getUser());
$thread->addSubscriber($bookingRequest->getPurchaser()->getUser());

I can attach entity to thread, but I use threads for different entities.

@qpleple
Copy link

qpleple commented May 26, 2014

See #296 for an example on how to use the event dispatcher with FOSCommentBundle.

@XWB XWB closed this as completed Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants