/** * Returns logged-in userId or anonymous sessionId. * * @return int|string */ private function getCurrentUserId() { if ($this->authorizationChecker->isGranted('IS_AUTHENTICATED_FULLY') | $this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED')) { return $this->repository->getCurrentUser()->id; } else { return $this->session->get('yc-session-id'); } }