Search code examples
phpsymfonyfoscommentbundle

FOSCommentBundle Custom comment sorting


I need to implement the custom comment sorting based on the comment score , i have gone through 14-customizing_tree_sorting.md The services: in my app/config.yml as follows

# app/config/config.yml
services:
     demoBundle.comment.sorter.score:
        class: DemoBundle\Bundle\Sorting\CommentOrderSorting
        tags:
            - { name: fos_comment.sorter, alias: score }

Here the overridden methods of SortingInterfac are not being called in my custom class CommentOrderSorting where i need to implement my logic

Thanks in adv.


Solution

  • I think you should also create config with your custom sorter:

    # app/config/config.yml
    fos_comment:
        service:
            sorting:
                default: score