Skip to content

Commit 5fe8330

Browse files
committed
1 parent 7f5a233 commit 5fe8330

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

GaelO2/app/GaelO/Entities/UserEntity.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class UserEntity
2020
public ?String $onboardingVersion;
2121
public ?string $emailVerifiedAt;
2222
public ?string $lastConnection;
23-
23+
2424
public CenterEntity $mainCenter;
2525
public array $affiliatedCenters;
2626

@@ -47,7 +47,7 @@ public static function fillFromDBReponseArray(array $array): UserEntity
4747
return $userEntity;
4848
}
4949

50-
public static function fillMinimalFromDBReponseArray(array $array): UserEntity
50+
public static function fillMinimalFromDBReponseArray(array $array, bool $withOnboarding = false): UserEntity
5151
{
5252
$userEntity = new UserEntity();
5353
$userEntity->id = $array['id'];
@@ -56,6 +56,7 @@ public static function fillMinimalFromDBReponseArray(array $array): UserEntity
5656
$userEntity->centerCode = $array['center_code'];
5757
$userEntity->email = $array['email'];
5858
$userEntity->phone = $array['phone'];
59+
if ($withOnboarding) $userEntity->onboardingVersion = $array['onboarding_version'];
5960
return $userEntity;
6061
}
6162

@@ -74,12 +75,12 @@ public function addRoles(array $roles): void
7475
$this->roles = $roles;
7576
}
7677

77-
public function setMainCenter(CenterEntity $mainCenter) :void
78+
public function setMainCenter(CenterEntity $mainCenter): void
7879
{
7980
$this->mainCenter = $mainCenter;
8081
}
8182

82-
public function setAffiliatedCenters(array $affiliatedCenters) :void
83+
public function setAffiliatedCenters(array $affiliatedCenters): void
8384
{
8485
$this->affiliatedCenters = $affiliatedCenters;
8586
}

GaelO2/app/GaelO/UseCases/GetUsersFromStudy/GetUsersFromStudy.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function execute(GetUsersFromStudyRequest $getUsersFromStudyRequest, GetU
3939
foreach ($dbData as $data) {
4040
$userEntity = [];
4141
if ($role === Constants::ROLE_SUPERVISOR) {
42-
$userEntity = UserEntity::fillMinimalFromDBReponseArray($data);
42+
$userEntity = UserEntity::fillMinimalFromDBReponseArray($data, true);
4343
$userEntity->setMainCenter(CenterEntity::fillFromDBReponseArray($data['main_center']));
4444
$affiliatedCenters = array_map(function($center){return CenterEntity::fillFromDBReponseArray($center);}, $data['affiliated_centers']);
4545
$userEntity->setAffiliatedCenters($affiliatedCenters);

0 commit comments

Comments
 (0)