Search code examples
phpsymfony4sylius

Sylius - [Admin] How to edit the indexAction grid query


I'm just trying to edit the indexAction in product controller doing some data filtering. what I did was I added new column as branch_code and in product table and the user table , when each user login to the system they show the product list according to the their branch_code

I'm just trying to change query in resources (Please refer the attachment). and I count catch it,enter image description here

What I need is, I want to add a WHERE condition to this query,

Can you please guide me solve this issue


Solution

  • You can extend the product repository and extend the createListQueryBuilder method to add your custom logic. If that is not enough, then you can create a new method, then override the admin product grid and change the repository method.