Add method to return an array of entities a given user has flagged with a given flag

Created on 17 May 2023, over 2 years ago

Problem/Motivation

It would be useful to be able to get an array of all entities that a user has flagged with a given flag, such as all article nodes they have bookmarked.

Proposed resolution

Add a method with code along these lines:

    $query = $this->entityTypeManager()->getStorage('flagging')->getQuery();
    $query->accessCheck(FALSE);
    $query->condition('flag_id', FLAG_ID);
    $query->condition('uid', UID);
    $nids = $query->execute();

Remaining tasks

Agree on name of method. Implement.

User interface changes

None.

API changes

Addition of one method.

Data model changes

None.

Feature request
Status

Active

Version

4.0

Component

Flag core

Created by

🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Liam Morland
  • Status changed to Needs work 11 months ago
  • 🇧🇾Belarus ivnish

    Needs reroll to MR. Also needs tests

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    Can you suggest what this method should be called?

  • Merge request !180Resolve #3361116 "Add method to" → (Open) created by ivnish
  • Pipeline finished with Canceled
    26 days ago
    #701935
  • Pipeline finished with Failed
    26 days ago
    Total: 318s
    #701938
  • Pipeline finished with Failed
    26 days ago
    Total: 425s
    #702003
  • Pipeline finished with Failed
    26 days ago
    Total: 246s
    #702021
  • Pipeline finished with Failed
    26 days ago
    Total: 181s
    #702079
  • Pipeline finished with Failed
    26 days ago
    Total: 386s
    #702090
  • Pipeline finished with Failed
    26 days ago
    Total: 165s
    #702290
Production build 0.71.5 2024