Guest User

Untitled

a guest
Jul 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. <?hh
  2.  
  3. function workspace_prefs_to_db_rows(workspace_t $workspace, array<string, mixed> $prefs): array<db_workspaces_prefs_row_t> {
  4. $pref_rows = [];
  5.  
  6. foreach ($prefs as $pref_name => $pref_value){
  7. $new_pref = shape(
  8. 'workspace_id' => $workspace['id'],
  9. 'pref_name' => $pref_name,
  10. 'pref_value' => json_encode($pref_value),
  11. );
  12.  
  13. $pref_rows[] = $new_pref;
  14. }
  15.  
  16. return $pref_rows;
  17. }
Add Comment
Please, Sign In to add comment