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

Created on 17 May 2023, almost 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

Comments & Activities

Production build 0.71.5 2024