13.
Filtros: Modificar consultas automáticamente
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
7 Comments
Amazing! Thanks for your tips 🙂
You're welcome!
Hi, really great explanation of filters, thanks. I got them working but I'm trying to filter by the current user, so that each table can be automatically filtered to show only records owned by that user. I can't work out how to send in a parameter value that changes (ie $this->getUser() ) and enable this globally. (I can get it working if I enable per-call but then I feel I may as well just add the WHERE clause to each query). I'm trying to make the application multi-tenant, but using global filters. What do you recommend?
Hey @Markchicobaby
IIRC these filters are the same services as any in the Symfony, so in theory, you can inject any service into the filter to get access to any parameter.
Cheers!
But about half way in it says "Now, one tricky thing about these filters is that they are not services" so I didn't think that was possible.
bah... my bad =) sorry for that. Yeah, that is a pretty tricky situation. However, there still are some ways to go.
For example you can use request event
Sorry again for my inattention!
Cheers!
OK cool I’ll give events a closer look. Thanks for the tip!
"Houston: no signs of life"
Start the conversation!