I'm working on a project using API Platform as a backend. I'd like to apply doctrine extension only for specific operations. For example, some "admin" operations (with specific uriTemplate) should provide data that is not present on "classic" operation, and I'd like this behavior to rely not only on user roles (a user with admin role should be able to use "classic" operation and get the same data as a non admin user). So, Api platform extensions are just nice to do this, but I wonder on what to rely to determine if an operation is eligible for an extension or not. One way to do it is to check operation's uriTemplate ("does it start with 'admin/'?" for example) but maybe this looks a little messy. Another way could be to add data in the operations extraProperties to tag it as eligible for a given extension. Is it what extraProperties are intended for? Is there another prefered solution? Thanks!
Asked
Active
Viewed 68 times