TypeError null given

Created on 30 May 2022, over 2 years ago
Updated 12 April 2024, 6 months ago

Problem/Motivation

Hi,

Indexed 2 different flags, 1 of them is content related flag and 1 is flag for user.

The content related flag works, but when clicking the user related flag, got this error and the flag is not flagged:

TypeError: Drupal\flag\FlagService::flag(): Argument #2 ($entity) must be of type Drupal\Core\Entity\EntityInterface,
null given, called in /var/www/html/site/web/modules/contrib/flag/src/Controller/ActionLinkController.php on line 78 in Drupal\flag\FlagService->flag()
(line 281 of /var/www/html/site/web/modules/contrib/flag/src/FlagService.php)

Steps to reproduce

1. create flag type of "user"
sert scope: personal
linkt type: ajax link
Display link as field

1.1 create flag type of "content"

2. create index
data sources: content,flagging,user

2.1 select processors
content access
double quote workaround
flag indexing
reverse entity references

2.2 select fields
General:
both flags
entity type
URI
2.3 Flagging
Entity » Content » ID
flag_id
ID
User ID » User » User ID (uid:entity:uid)

2.4 User
search_api_reverse_entity_references_flagging__uid:uid
search_api_reverse_entity_references_flagging__uid:flag_id

3. create view
add indexed flags as fields

RESULT
the content related flag is working,
but the user related creates error and is not flagged.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Closed: works as designed

Version

1.5

Component

Code

Created by

🇫🇮Finland jukka792

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇭🇷Croatia MilosR Croatia, Montenegro

    @jukka792

    Can you check when hovering over the flag link if there's something like this in the link: "/typeerror-null-given"?

  • Status changed to Closed: works as designed 6 months ago
  • 🇭🇷Croatia MilosR Croatia, Montenegro
Production build 0.71.5 2024