mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
docgen normalization budget: fix budget when person is null
This commit is contained in:
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\BudgetBundle\Service\Summary\SummaryBudget;
|
||||
use Chill\BudgetBundle\Service\Summary\SummaryBudgetInterface;
|
||||
use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\Civility;
|
||||
@@ -45,7 +45,7 @@ class PersonDocGenNormalizer implements
|
||||
|
||||
private RelationshipRepository $relationshipRepository;
|
||||
|
||||
private SummaryBudget $summaryBudget;
|
||||
private SummaryBudgetInterface $summaryBudget;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
@@ -56,7 +56,7 @@ class PersonDocGenNormalizer implements
|
||||
RelationshipRepository $relationshipRepository,
|
||||
TranslatorInterface $translator,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
SummaryBudget $summaryBudget
|
||||
SummaryBudgetInterface $summaryBudget
|
||||
) {
|
||||
$this->personRender = $personRender;
|
||||
$this->relationshipRepository = $relationshipRepository;
|
||||
@@ -214,6 +214,14 @@ class PersonDocGenNormalizer implements
|
||||
$data['relations'] = [];
|
||||
}
|
||||
|
||||
if ($context['docgen:person:with-budget'] ?? false) {
|
||||
$data['budget']['person'] = $this->summaryBudget->getSummaryForPerson(null);
|
||||
|
||||
if ($context['docgen:person:with-household'] ?? false) {
|
||||
$data['budget']['household'] = $this->summaryBudget->getSummaryForHousehold(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user