Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony Sylius Grid EntityFilter-排序或使用存储库_Symfony_Sylius - Fatal编程技术网

Symfony Sylius Grid EntityFilter-排序或使用存储库

Symfony Sylius Grid EntityFilter-排序或使用存储库,symfony,sylius,Symfony,Sylius,我在一个Sylius网格配置中添加了一个大型实体过滤器。除了类名称之外,我还没有找到任何配置选项,从外观上看,选项值只是按ID排序的。有没有办法使用存储库方法或至少提供排序字段?是否需要为此使用自定义筛选器?您可以定义要在YAML文件上使用的存储库方法以及要发送到该方法的参数: sylius_grid: grids: app_user: # Your grid name driver: name: doctrine/

我在一个Sylius网格配置中添加了一个大型实体过滤器。除了
名称之外,我还没有找到任何配置选项,从外观上看,选项值只是按ID排序的。有没有办法使用存储库方法或至少提供排序字段?是否需要为此使用自定义筛选器?

您可以定义要在YAML文件上使用的存储库方法以及要发送到该方法的参数:

sylius_grid:
    grids:
        app_user: # Your grid name
            driver:
                name: doctrine/orm
                options:
                    class: "%app.model.user%"
                    repository:
                        method: myCustomMethod
                        arguments:
                            id: resource.id
            sorting:
                name: asc
            limits: [10, 25, 50, 100]

查看Sylius网格包文档以了解更多信息:

抱歉,这为网格本身定义了一个存储库方法,即主实例。我想要的是过滤器定义的类似选项,例如,过滤器:city:type:entity form_选项:class:Sylius\Component\Addressing\Model\city\repository:#方法:getCities但这不起作用。您需要一个类型,过滤器,然后标记服务:
名称:sylius.grid\u过滤器,类型:my\u entity\u类型,表单类型:AppBundle\grid\Filter\MyEntityFilterType
,然后您可以使用过滤器:my\u entity\u类型,如果您需要,我将使用工作代码I编辑我的答案have@SantiBarbat嘿,我知道一年过去了,但我需要的正是你所说的,你能分享这些信息吗?谢谢