update to Symfony 4.4 (#1275)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace App\Invoice\Calculator;
|
||||
|
||||
use App\Invoice\CalculatorInterface;
|
||||
use App\Invoice\InvoiceItem;
|
||||
use App\Invoice\InvoiceModel;
|
||||
|
||||
@@ -87,11 +88,17 @@ abstract class AbstractCalculator
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.8 will be removed with 2.0
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency(): string
|
||||
{
|
||||
return $this->model->getCustomer()->getCurrency();
|
||||
@trigger_error(
|
||||
sprintf('%s::getCurrency() is deprecated and will be removed with 2.0', CalculatorInterface::class),
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
|
||||
return $this->model->getCurrency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,6 +52,7 @@ interface CalculatorInterface
|
||||
/**
|
||||
* Returns the currency for the invoices amounts.
|
||||
*
|
||||
* @deprecated since 1.8 will be removed with 2.0
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency(): string;
|
||||
|
||||
@@ -211,13 +211,23 @@ final class InvoiceModel
|
||||
return $this->formatter;
|
||||
}
|
||||
|
||||
public function getCurrency(): string
|
||||
{
|
||||
if (null === $this->getCustomer()) {
|
||||
// this should be set from the configuration
|
||||
return Customer::DEFAULT_CURRENCY;
|
||||
}
|
||||
|
||||
return $this->getCustomer()->getCurrency();
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
$model = $this;
|
||||
$customer = $model->getCustomer();
|
||||
$project = $model->getQuery()->getProject();
|
||||
$activity = $model->getQuery()->getActivity();
|
||||
$currency = $model->getCalculator()->getCurrency();
|
||||
$currency = $this->getCurrency();
|
||||
$tax = $model->getCalculator()->getTax();
|
||||
$total = $model->getCalculator()->getTotal();
|
||||
$subtotal = $model->getCalculator()->getSubtotal();
|
||||
|
||||
Reference in New Issue
Block a user