自定义评论排序


FOSCommentBundle Custom comment sorting

我需要实现基于评论评分的自定义评论排序,我已经完成了14-customizing_tree_sorting.mdmy app/config.yml中的services:如下

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

在这里,SortingInterfac的重写方法没有在我的自定义类CommentOrderSorting中调用,我需要实现我的逻辑

Thanks in ad .

我认为你也应该创建配置与您的自定义排序器:

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