Created
July 18, 2018 23:54
-
-
Save alisha/b93dce06b8d6c444035e774f0057ffe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?hh | |
function workspace_prefs_to_db_rows(workspace_t $workspace, array<string, mixed> $prefs): array<db_workspaces_prefs_row_t> { | |
$pref_rows = []; | |
foreach ($prefs as $pref_name => $pref_value){ | |
$new_pref = shape( | |
'workspace_id' => $workspace['id'], | |
'pref_name' => $pref_name, | |
'pref_value' => json_encode($pref_value), | |
); | |
$pref_rows[] = $new_pref; | |
} | |
return $pref_rows; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment