Skip to content

Commit d176422

Browse files
committed
fix: Corrected blueprint normalization for attributes
1 parent d4efd76 commit d176422

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

src/Blueprint/Application/Model/Assets/AssetsAggregate.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,18 @@ public function getIterator(): \ArrayIterator
5959
public function normalize(): array
6060
{
6161
return array_map(
62-
fn (mixed $asset) => $asset instanceof Normalizable ? $asset->normalize() : $asset,
62+
fn (mixed $asset) => $asset instanceof Normalizable
63+
? $asset->normalize()
64+
: (
65+
is_iterable($asset)
66+
? array_map(
67+
fn (mixed $item) => $item instanceof Normalizable
68+
? $item->normalize()
69+
: $item,
70+
(array) $asset
71+
)
72+
: $asset
73+
),
6374
$this->assets
6475
);
6576
}

tests/Assets/pbaszak_ultramapper_tests_assets_dummysimplewithattribute.yaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ blueprints:
2929
docBlock: false
3030
attributes:
3131
PBaszak\UltraMapper\Mapper\Application\Attribute\Callback:
32-
- null
33-
- null
32+
-
33+
class: PBaszak\UltraMapper\Mapper\Application\Attribute\Callback
34+
arguments:
35+
- test
36+
-
37+
class: PBaszak\UltraMapper\Mapper\Application\Attribute\Callback
38+
arguments:
39+
- test2
3440
name:
3541
originName: name
3642
path: name
@@ -66,7 +72,9 @@ blueprints:
6672
docBlock: false
6773
attributes:
6874
PBaszak\UltraMapper\Mapper\Application\Attribute\Ignore:
69-
- null
75+
-
76+
class: PBaszak\UltraMapper\Mapper\Application\Attribute\Ignore
77+
arguments: { }
7078
methods:
7179
__construct:
7280
visibility: public

0 commit comments

Comments
 (0)