I am using the SonataAdminBundle with FosUserBundle. I have a bit of problems in my dashboard.
In my application, I have resources, companies and users. An user belongs to a company, and can create resources which will belong to his company too. All this procces will be done in the dashboard, which is accessible for all roles.
What I am triying to do is that everybody could access to the dashboard, but when an user select an entity(resource) to list in the dashboard, only the entities of his companies will be shown. For example, two companies could create a vehicle(resource), but each company only will see his own vehicles(resources).
Concluding, I want that the Dashboard filter the entities of the company of the user that is connected. Is there any way to create in the Sonata a query to shown only some entities depending on the Company_Id of the user and the Company_Id of the resource mapped in the BBDD?