Skip to content

Commit 4908dfe

Browse files
committed
feat: extend degree program data to include campo keys from all associated terms
1 parent 5b5de9d commit 4908dfe

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Domain/CampoKeys.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
namespace Fau\DegreeProgram\Common\Domain;
66

77
/**
8-
* @psalm-type CampoKeysMap = array<value-of<self::SUPPORTED_CAMPO_KEYS>, string>
8+
* @psalm-type CampoKeysMap = array<value-of<self::SUPPORTED_CAMPO_KEYS>, array<int, string>|string>
99
*/
1010
final class CampoKeys
1111
{
1212
public const SCHEMA = [
1313
'type' => 'object',
1414
'properties' => [
1515
DegreeProgram::DEGREE => [
16-
'type' => 'string',
16+
'type' => 'array',
1717
],
1818
DegreeProgram::AREA_OF_STUDY => [
19-
'type' => 'string',
19+
'type' => 'array',
2020
],
2121
DegreeProgram::LOCATION => [
22-
'type' => 'string',
22+
'type' => 'array',
2323
],
2424
],
2525
];
@@ -28,13 +28,13 @@ final class CampoKeys
2828
'type' => 'object',
2929
'properties' => [
3030
DegreeProgram::DEGREE => [
31-
'type' => 'string',
31+
'type' => 'array',
3232
],
3333
DegreeProgram::AREA_OF_STUDY => [
34-
'type' => 'string',
34+
'type' => 'array',
3535
],
3636
DegreeProgram::LOCATION => [
37-
'type' => 'string',
37+
'type' => 'array',
3838
],
3939
],
4040
];

src/Infrastructure/Repository/CampoKeysRepository.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function degreeProgramCampoKeys(DegreeProgramId $degreeProgramId): CampoK
5151
continue;
5252
}
5353

54-
$map[$campoKeyType] = $campoKey;
54+
$map[$campoKeyType][$term->term_id] = $campoKey;
5555
}
5656

5757
return CampoKeys::fromArray($map);
@@ -69,9 +69,9 @@ public function taxonomyToTermsMapFromCampoKeys(CampoKeys $campoKeys): array
6969
$campoKeys = $campoKeys->asArray();
7070

7171
foreach (self::TAXONOMY_TO_CAMPO_KEY_MAP as $taxonomy => $campoKeyType) {
72-
$campoKey = $campoKeys[$campoKeyType] ?? '';
72+
$campoKey = $campoKeys[$campoKeyType] ?? null;
7373

74-
if ($campoKey === '') {
74+
if (!is_string($campoKey) || $campoKey === '') {
7575
continue;
7676
}
7777

0 commit comments

Comments
 (0)