Search code examples
phpsymfonydatagridorocrm

Pass array as a bindparameter to the datagrid in orocrm


I want to pass array in DataGrid as a parameter. Currently i am passing single value as:

.twig file

dataGrid.renderGrid(gridName, { products: '34'}, { cssClass: 'inner-grid' })

datagrid.yml file

bind_parameters:

            -   name: products
                default: null
                type: integer

But i want pass an array and bind that array with the DataGrid. I want the solution for that.


Solution

  • datagrid.yml

    source:
            type: orm
            query:
                select:
                    - product.id
                    - product.name
                    - product.quoteQuantity
                    - product.discount
                    - product.customPrice
    
                from:
                    - { table: %inventory_product.product.entity.class%, alias: product }
                where:
                    and:
                        - product.id IN (:products)
            bind_parameters:
                -   name: products
    

    .twig file

    dataGrid.renderGrid(gridName, { products: productdata}, { cssClass: 'inner-grid' })
    

    Just pass the array as a parameter and bind that with the datagrid file