mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
fixes: add tests for generation and fix some situation
This commit is contained in:
@@ -44,6 +44,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function array_key_exists;
|
||||
|
||||
/**
|
||||
* @see AccompanyingPeriodContextTest
|
||||
* @template-implements DocGeneratorContextWithPublicFormInterface<AccompanyingPeriod>
|
||||
*/
|
||||
class AccompanyingPeriodContext implements
|
||||
@@ -116,12 +117,11 @@ class AccompanyingPeriodContext implements
|
||||
'person2' => $data['person2'] ?? false,
|
||||
'person2Label' => $data['person2Label'] ?? $this->translator->trans('docgen.person 2'),
|
||||
'thirdParty' => $data['thirdParty'] ?? false,
|
||||
'thirdPartyLabel' => $data['thirdPartyLabel'] ?? $this->translator->trans('thirdParty'),
|
||||
'thirdPartyLabel' => $data['thirdPartyLabel'] ?? $this->translator->trans('Third party'),
|
||||
];
|
||||
|
||||
if (array_key_exists('category', $data)) {
|
||||
$r['category'] = array_key_exists('category', $data) ?
|
||||
$this->documentCategoryRepository->find($data['category']) : null;
|
||||
$r['category'] = $this->documentCategoryRepository->find($data['category']);
|
||||
}
|
||||
|
||||
return $r;
|
||||
@@ -214,17 +214,15 @@ class AccompanyingPeriodContext implements
|
||||
}
|
||||
|
||||
$thirdParties = array_merge(
|
||||
array_filter(array_values([$entity->getRequestorThirdParty()])),
|
||||
array_filter(
|
||||
array_values(
|
||||
array_map(
|
||||
fn (Resource $r): ?ThirdParty => $r->getThirdParty(),
|
||||
$entity->getResources()->filter(
|
||||
static fn (Resource $r): bool => null !== $r->getThirdParty()
|
||||
)->toArray()
|
||||
)
|
||||
array_values(array_filter([$entity->getRequestorThirdParty()])),
|
||||
array_values(array_filter(
|
||||
array_map(
|
||||
fn (Resource $r): ?ThirdParty => $r->getThirdParty(),
|
||||
$entity->getResources()->filter(
|
||||
static fn (Resource $r): bool => null !== $r->getThirdParty()
|
||||
)->toArray()
|
||||
)
|
||||
)
|
||||
))
|
||||
);
|
||||
|
||||
if ($options['thirdParty'] ?? false) {
|
||||
@@ -320,7 +318,7 @@ class AccompanyingPeriodContext implements
|
||||
$normalized[$k] = null !== ($data[$k] ?? null) ? $data[$k]->getId() : null;
|
||||
}
|
||||
|
||||
$normalized['thirdParty'] = null === $data['thirdParty'] ? null : $data['thirdParty']->getId();
|
||||
$normalized['thirdParty'] = ($data['thirdParty'] ?? null)?->getId();
|
||||
|
||||
return $normalized;
|
||||
}
|
||||
|
Reference in New Issue
Block a user