Skip to content

Instantly share code, notes, and snippets.

@davidhemphill
Last active January 18, 2016 20:47
Show Gist options
  • Save davidhemphill/5bbc4f67cd6a8660facb to your computer and use it in GitHub Desktop.
Save davidhemphill/5bbc4f67cd6a8660facb to your computer and use it in GitHub Desktop.
Pretend you have a report that does a bunch of calculations and data query finagling and now you need to show it. How do you like to get that data back?
<?php
/**
* Send a data array back like an animal
*/
// Send an array back from the report
$data_array = $report->getAllTheData();
// Display the data and the totals
$data = $data_array['data'];
$totals = $data_array['totals'];
// Display the data from the array
<?php
/**
* Make separate calls to a reporting object
*/
$data = $report->getData();
$totals = $report->getTotals($data_for_thing);
// Display the data and the totals in a View, PDF, or CSV
<?php
/**
* Send back a value object from the report
*/
// Send another friggin object back from the report
// The report object returns up the value object
$value_object = $report->getAllTheData();
// Display the data and the totals
$data = $value_object->getData();
$totals = $value_object->getTotals();
// Display the data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment