FriendsOfSymfony / FOSCommentBundle

Threaded comments for Symfony
http://friendsofsymfony.github.com/
MIT License
462 stars 230 forks source link

Can't override templates using templates/bundles directory #635

Closed mkruk-u2 closed 6 years ago

mkruk-u2 commented 6 years ago

We're updating our project to use Symfony 4 and we're trying to move our templates to templates/ directory. Since we override some of FOSCommentBundle templates we would like to move them under templates/bundles/FOSCommentBundle/ (as suggested here) but this doesn't seem to work - our customized templates are not loaded and default bundle templates are still used.

How can we override templates using templates/ directory?

Our current setup:

emulienfou commented 6 years ago

Hi @mkruk-u2, I'm in the same situation as you with Symfony 4!

The problem is they use the class TemplateReference to call the template file. With this code it seems we cannot override the templates files.

So to fix this issue, we need to replace the code like:

->setTemplate(new TemplateReference('FOSCommentBundle', 'Thread', 'comments'));

by

->setTemplate('@FOSComment/Thread/comments.html.twig');

I will change the code, test it and do a PullRequest as soon as possible.

XWB commented 6 years ago

Should be fixed in https://github.com/FriendsOfSymfony/FOSCommentBundle/pull/651