Skip to content

Instantly share code, notes, and snippets.

@damiankloip
Created June 8, 2012 15:01
Show Gist options
  • Save damiankloip/2896050 to your computer and use it in GitHub Desktop.
Save damiankloip/2896050 to your computer and use it in GitHub Desktop.
/**
* @todo.
*/
public function pack($exportable) {
$data = array();
foreach ($this->schema['fields'] as $field => $info) {
if (isset($exportable->{$field})) {
$data[$field] = $exportable->{$field};
}
else {
$data[$field] = !empty($info['default']) ? $info['default'] : NULL;
}
}
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment