Noticed recently that entityqueue passes queue names when calling $entity->id().

Specifically, line 27 of permissions_by_term.module passes:
if ($cache->hasAccessResultsCache($account->id(), $entity->id())) {
When this goes into hasAccessResultsCache in/src/Cache/AccessResultCache.php, its forcing int for the id on line 61:
public function hasAccessResultsCache(int $accountId, int $entityId): bool {

Entity Queue uses a text value for id/name field. $entity->id() when called for an entityqueue returns the following in my case:
editors_picks

Not sure where is the best place to bring up this issue. I suspect entityqueue should be using int for id's and not a string. Also not sure if that's a hard requirement for Drupal. In either event, we could remove the "int" requirement for setting and accessing result cache. That's the only way I can see resolving the issue for now.

Thoughts?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rjdjohnston created an issue. See original summary.

bstan’s picture

I have seen this as well

amateescu’s picture

I suspect entityqueue should be using int for id's and not a string.

Using string IDs for entityqueue was a design decision, and it's a use case that is fully supported by Drupal core :)

public function hasAccessResultsCache(int $accountId, int $entityId): bool {

This is the part that needs to be fixed, the int type is arbitrarily placed there.

amateescu’s picture

Status: Active » Needs review
eahonet’s picture

Thank you @amateescu

Removing the three "int"s as shown in the merge request did do the trick for me. I can now access my entityequeues.

  • Peter Majmesku committed 6903f01 on 8.x-2.x
    Issue #3150746 by amateescu: Does not work with Entity Queue
    
jepster_’s picture

Status: Needs review » Fixed

@eahonet: Thanks for testing and sharing your patches! I have reviewed your patches and added them to the latest releases:

Drupal 9 version (3.1.5): https://www.drupal.org/project/permissions_by_term/releases/3.1.5
Drupal 8 version (8.x-2.28): https://www.drupal.org/project/permissions_by_term/releases/8.x-2.28

jepster_’s picture

Status: Fixed » Closed (fixed)