Created
October 18, 2012 07:35
-
-
Save anonymous/3910303 to your computer and use it in GitHub Desktop.
InvoiceObjectCollection
This file contains 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
// from lib/model/collection/InvoiceObjectCollection.php | |
class InvoiceObjectCollection extends PropelObjectCollection | |
{ | |
/** | |
* Get the date range of invoices generated | |
* | |
* @param string $format | |
* @return type | |
*/ | |
public function getDateRange($format = 'Y-m-d H:i:s') | |
{ | |
return [ | |
$this->getFirst()->getCreatedAt($format), | |
$this->getLast()->getCreatedAt($format) | |
]; | |
} | |
/** | |
* Returns commission on ad spent in pennies | |
* | |
* @return int | |
*/ | |
public function getCommissionOnSpend() | |
{ | |
$amt = 0; | |
foreach($this as $invoice) | |
{ | |
$amt += $invoice->getCommissionOnSpend(); | |
} | |
return $amt; | |
} | |
}% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment