sylius_grid:
    grids:
        sylius_admin_product_variant:
            driver:
                name: doctrine/orm
                options:
                    class: "%sylius.model.product_variant.class%"
                    repository:
                        method: createQueryBuilderByProductId
                        arguments: ["expr:service('sylius.context.locale').getLocaleCode()", $productId]
            sorting:
                position: asc
            fields:
                name:
                    type: twig
                    path: .
                    label: sylius.ui.name
                    options:
                        template: "@SyliusAdmin/ProductVariant/Grid/Field/name.html.twig"
                code:
                    type: string
                    label: sylius.ui.code
                enabled:
                    type: twig
                    label: sylius.ui.enabled
                    options:
                        template: "@SyliusUi/Grid/Field/enabled.html.twig"
                inventory:
                    type: twig
                    path: .
                    label: sylius.ui.inventory
                    options:
                        template: "@SyliusAdmin/ProductVariant/Grid/Field/inventory.html.twig"
                position:
                    type: twig
                    label: sylius.ui.position
                    path: .
                    sortable: position
                    options:
                        template: "@SyliusAdmin/ProductVariant/Grid/Field/position.html.twig"
            filters:
                code:
                    type: string
                    label: sylius.ui.code
                name:
                    type: string
                    label: sylius.ui.name
                    options:
                        fields: [translation.name]
            actions:
                main:
                    generate:
                        type: generate_variants
                        options:
                            product: expr:service('sylius.repository.product').find($productId)
                    update_positions:
                        type: update_product_variant_positions
                    create:
                        type: create
                        options:
                            link:
                                parameters:
                                    productId: $productId
                item:
                    update:
                        type: update
                        options:
                            link:
                                parameters:
                                    id: resource.id
                                    productId: $productId
                    delete:
                        type: delete
                        options:
                            link:
                                parameters:
                                    id: resource.id
                                    productId: $productId
                bulk:
                    delete:
                        type: delete
                        options:
                            link:
                                parameters:
                                    productId: $productId
