Skip to content
Snippets Groups Projects
Commit 92470aa8 authored by sv's avatar sv Committed by Taras Kruts
Browse files

Issue #3365912 by SV: Fix incorrect type check for $user_id var

The id() method of EntityInterface can return: string|int|null. So, is_int() check will be always false and we will have empty result in exported CSV
parent 74f93e0b
No related branches found
No related tags found
No related merge requests found
Showing
with 11 additions and 11 deletions
......@@ -28,7 +28,7 @@ class UserAnalyticsCommentsCreated extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
......
......@@ -28,7 +28,7 @@ class UserAnalyticsEventEnrollments extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
......
......@@ -28,7 +28,7 @@ class UserAnalyticsEventsCreated extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
......
......@@ -91,11 +91,11 @@ class UserAnalyticsGroupMemberships extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
return (string) count($this->groupHelper->getAllGroupsForUser($user_id));
return (string) count($this->groupHelper->getAllGroupsForUser((int) $user_id));
}
}
......@@ -28,7 +28,7 @@ class UserAnalyticsGroupsCreated extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
......
......@@ -28,7 +28,7 @@ class UserAnalyticsLikes extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
......
......@@ -28,7 +28,7 @@ class UserAnalyticsPostsCreated extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
......
......@@ -28,7 +28,7 @@ class UserAnalyticsTopicsCreated extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "0";
}
......
......@@ -92,10 +92,10 @@ class UserGroupMemberships extends UserExportPluginBase {
*/
public function getValue(UserInterface $entity) {
$user_id = $entity->id();
if (!is_int($user_id)) {
if (!$user_id) {
return "";
}
$group_memberships = Group::loadMultiple($this->groupHelper->getAllGroupsForUser($user_id));
$group_memberships = Group::loadMultiple($this->groupHelper->getAllGroupsForUser((int) $user_id));
$groups = [];
foreach ($group_memberships as $group) {
$groups[] = "{$group->label()} ({$group->id()})";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment