Last active
January 18, 2016 20:47
-
-
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?
This file contains hidden or 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
<?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 |
This file contains hidden or 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
<?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 |
This file contains hidden or 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
<?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