I'm just about to write a method for converting some billing data into an invoice.
So say that I have an array of objects that contain the data needed to create the invocie elements.
In the billing controller Which of the following methods is correct:
$invoice = new Invoice();
$invoice->createInvoiceFromBilling($billingItems);
Then in the class of accounts
Public Function createInvoiceFromBilling($billingItems)
{
$this->data = $billingItems;
OR
Invoice::createInvoiceFromBilling($billingItems)
Then in the class of accounts
Public Function createInvoiceFromBilling($billingItems)
{
$invoice = new Invoice();
$invoice->data = $billingItems;
How is this the right way?
Hello
source
share