I use extensions quite intensive, because I use them to limit users into the proper scopes (e.g. user cant see the data from the other company and even in his company he can see the limited data based on permissions). I noticed, that in many (all?) cases when ApiP prepares query to DB, it goes through all the extensions and apply each one.
May be it's a good idea to create CacheableExtension interface with supports method to optimize the process?
Shouldn't you restrict access using voters?
@er1z for collections it's better (for performance and security) to filter at the DBMS level, and to retrieve only relevant data. It's also the only way to have a working pagination.
@Siregacvek could be a nice improvement indeed, it could take some inspiration from the similar interface of the Symfony Serializer.
@er1z I use voters for CUD operations. For Read I use extensions as a recommended way. BTW Symfony voters has no cache too - I feel this could a very good Symfony PR-improvement and may increase performance in big systems.
@dunglas yes, I meant the similar approach like in Symfony Serializer. I'll try to deploy PR if I find a time to create it. Thanks.
Most helpful comment
@er1z I use voters for CUD operations. For Read I use extensions as a recommended way. BTW Symfony voters has no cache too - I feel this could a very good Symfony PR-improvement and may increase performance in big systems.
@dunglas yes, I meant the similar approach like in Symfony Serializer. I'll try to deploy PR if I find a time to create it. Thanks.