I'm trying to create a custom query access handler for one of our custom entities, and I must be missing something or have the wrong concept of how this is all supposed to work.

Currently I have this in my entity definition file.

"query_access" = "Drupal\fs_report_entity\Entity\Access\ReportQueryAccessHandler"

Which I assumed would call that query access handler anytime I do a \Drupal::entityQuery call for entities of that type, but nothing happens.

I even put a logger in the constructor of that access handler and it never fires.

I'm having a hell of a time finding any documentation on how to actually use this feature. Any help would be greatly appreciated.

  • query_access seems not to be in core, only found it in the contrib module Entity API. You might want to clarify whether this is about this module, which is not used very often in D8. – 4k4 Oct 29 '19 at 14:31
  • I didn't realize Entity API wasn't part of core, than might be my whole problem then... let me go install it and see if it works. Thank You! – Andrew Blosser Oct 29 '19 at 14:55
  • 1
    Entity API is part of core, so you don't need the D8 version of that module, unless you want to try new features now in development, which one of them would be this handler. – 4k4 Oct 29 '19 at 15:00
  • 1
    That was the problem! Thank you so much for clarifying that Entity API is both in core and not in core! – Andrew Blosser Oct 29 '19 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.