From feb5273a43acfe78448a8052bfb3295ff725c9ff Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Jul 2023 17:33:45 +0200 Subject: [PATCH] patch to add status to all profiles --- tools/patches/addActiveStateToProfile.php | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/patches/addActiveStateToProfile.php diff --git a/tools/patches/addActiveStateToProfile.php b/tools/patches/addActiveStateToProfile.php new file mode 100644 index 0000000..acfd99a --- /dev/null +++ b/tools/patches/addActiveStateToProfile.php @@ -0,0 +1,38 @@ +query( $sql ); + $res = $stmt->fetchAll(); + + $db->beginTransaction(); + foreach( $res as $row ) + { + if ( is_array( $row ) && isset( $row[ 'id' ] ) ) + { + + $entProfile = TB_Shared_Ent_TeamData_Profile::get( $row[ 'id' ] ); + $resTeam = []; + foreach ($entProfile->teams_js as $team) { + $tmpTeam = $team; + $tmpTeam['status'] = 'active'; + $resTeam[] = $tmpTeam; + } + $entProfile->teams_js = $resTeam; + $entProfile->save(); + unset($team); + unset( $entProfile ); + } + } + $db->commit(); + + echo "DONE..."; +} + +patch_addStatusToProfileArrays(); \ No newline at end of file