0

I am struggling with installation of FOS Comment Bundle. I have Symfony v 4.2.1. I followed instructions from documentation: https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/Resources/doc/1-setting_up_the_bundle.md

I ommitted only this part: assetic: bundles: [ "FOSCommentBundle" ] Because assetic is not working with Symfony ^4. I installed assets by: bin/console assets:install

I get that error:

LoadException: Cannot load resource "@FOSCommentBundle/Resources/config/routing.yml". Make sure the "FOSCommentBundle" bundle is correctly registered and loaded in the application kernel class. If the bundle is registered, make sure the bundle path "@FOSCommentBundle/Resources/config/routing.yml" is not empty.)

Routes.yaml:

fos_comment_api:
type: rest
resource: '@FOSCommentBundle/Resources/config/routing.yml'
prefix: /api
defaults: { _format: html }

I did not find any solution. Anyone knows what should I do or know any alternative bundle to comments' threads?

  • 1
    Just out of curiosity I loaded the comment bundle in a fresh 4.2 project and the routes seemed to work as expected. Did you follow the suggestions in the error message and verify config/bundles.php as well as the existence of the FOSComment routing file? – Cerad Dec 10 '18 at 20:54
  • "FOS\RestBundle\FOSRestBundle::class => ['all', true], FOS\CommentBundle\FOSCommentBundle::class => ['all' => true], JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true]," I have that added in bundles.php – demotywatorking Dec 10 '18 at 22:35
  • 1
    And I assume you double checked that you have a vendor/friendsofsymfony/fos-comment directory. Not too sure what else to try. I just did a "composer create-project symfony/website-skeleton" followed by "composer require friendsofsymfony/comment-bundle" , added the db_driver config option and the route file entry. Maybe try deleting the cache? Maybe try a fresh project just to verify nothing else is messing things up. But it should be pretty straight forward. – Cerad Dec 10 '18 at 23:06
  • Find it, I had "['all', true]" instaed of ['all' => true] in bundles.php – demotywatorking Dec 11 '18 at 13:43
  • 1
    Glad you got it working. Strange you had to add the line. In my case, simply doing the composer require allowed the Symfony recipe to automatically add the line. I had to manually add the config file and routing section by hand which should have also been done automatically but bundles.php at least got updated. – Cerad Dec 11 '18 at 14:25

0 Answers0