Skip to content

Instantly share code, notes, and snippets.

@sufian07
Created August 16, 2018 14:59
Show Gist options
  • Save sufian07/dfec6b3bb8ab7d60cb534a7ebe711569 to your computer and use it in GitHub Desktop.
Save sufian07/dfec6b3bb8ab7d60cb534a7ebe711569 to your computer and use it in GitHub Desktop.
<?php
$selects[] = rtrim( join( array_map(
function ($custom_field)
{
$alias = 'custom' . $custom_field;
return "(SELECT wcf.value FROM workorder_custom_fields as wcf"
." WHERE wcf.workorder_id=w.workorder_id"
." AND wcf.custom_label_id='". dbsafe($custom_field). "') as `$alias`, ";
},
$customFields
), ''), ', ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment