- π³π±Netherlands Web-Beest
If you want to use the session_id (in case of anonymous users), you should use the session id generated by the flag service in stead of the sessionManager. They are different ;-)
$flag = $this->flagService->getFlagById('flag_id'); $user = $this->currentUser; $session_id = $this->flagService->getAnonymousSessionId(); $query = $this->database ->select('flagging', 'f') ->fields('f', []) ->condition('flag_id', $flag->id()) ->condition('uid', $user->id()); if ($user->isAnonymous()) { $query->condition('session_id', $session_id); } $result = $query->execute()->fetchAll();