add basic context for AccompanyingPeriodWorkEvalution WIP

This commit is contained in:
2021-12-03 13:50:35 +01:00
parent e053529afb
commit 23eff9f6d4
7 changed files with 253 additions and 74 deletions

View File

@@ -64,26 +64,36 @@ class AccompanyingPeriodContext implements
public function adminFormReverseTransform(array $data): array
{
return [
$data = [
'mainPerson' => $data['mainPerson'],
'person1' => $data['person1'],
'person2' => $data['person2'],
'category' => [
];
if (array_key_exists('category', $data)) {
$data['category'] = [
'idInsideBundle' => $data['category']->getIdInsideBundle(),
'bundleId' => $data['category']->getBundleId(),
],
];
];
}
return $data;
}
public function adminFormTransform(array $data): array
{
return [
$data = [
'mainPerson' => $data['mainPerson'] ?? false,
'person1' => $data['person1'] ?? false,
'person2' => $data['person2'] ?? false,
'category' => array_key_exists('category', $data) ?
$this->documentCategoryRepository->find($data['category']) : null,
];
if (array_key_exists('category', $data)) {
$data['category'] = array_key_exists('category', $data) ?
$this->documentCategoryRepository->find($data['category']) : null;
}
return $data;
}
public function buildAdminForm(FormBuilderInterface $builder): void