Skip to content

Commit 3909f96

Browse files
committed
fix(state): object mapper flag
1 parent 1f33ee6 commit 3909f96

File tree

22 files changed

+262
-54
lines changed

22 files changed

+262
-54
lines changed

src/Metadata/ApiResource.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,9 @@ public function __construct(
969969
array|Parameters|null $parameters = null,
970970
protected ?bool $strictQueryParameterValidation = null,
971971
protected ?bool $hideHydraOperation = null,
972-
?bool $jsonStream = null,
972+
protected ?bool $jsonStream = null,
973973
protected array $extraProperties = [],
974+
?bool $map = null,
974975
) {
975976
parent::__construct(
976977
shortName: $shortName,
@@ -1016,7 +1017,8 @@ class: $class,
10161017
strictQueryParameterValidation: $strictQueryParameterValidation,
10171018
hideHydraOperation: $hideHydraOperation,
10181019
jsonStream: $jsonStream,
1019-
extraProperties: $extraProperties
1020+
extraProperties: $extraProperties,
1021+
map: $map
10201022
);
10211023

10221024
/* @var Operations<HttpOperation> $operations> */

src/Metadata/Delete.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public function __construct(
101101
protected ?bool $hideHydraOperation = null,
102102
?bool $jsonStream = null,
103103
array $extraProperties = [],
104+
?bool $map = null,
104105
) {
105106
parent::__construct(
106107
method: 'DELETE',
@@ -183,6 +184,7 @@ class: $class,
183184
strictQueryParameterValidation: $strictQueryParameterValidation,
184185
hideHydraOperation: $hideHydraOperation,
185186
stateOptions: $stateOptions,
187+
map: $map
186188
);
187189
}
188190
}

src/Metadata/Error.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public function __construct(
9595
?OptionsInterface $stateOptions = null,
9696
?bool $hideHydraOperation = null,
9797
?bool $jsonStream = null,
98+
?bool $map = null,
9899
array $extraProperties = [],
99100
) {
100101
parent::__construct(
@@ -171,6 +172,7 @@ class: $class,
171172
stateOptions: $stateOptions,
172173
hideHydraOperation: $hideHydraOperation,
173174
jsonStream: $jsonStream,
175+
map: $map,
174176
extraProperties: $extraProperties,
175177
);
176178
}

src/Metadata/Get.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public function __construct(
101101
protected ?bool $hideHydraOperation = null,
102102
?bool $jsonStream = null,
103103
array $extraProperties = [],
104+
?bool $map = null,
104105
) {
105106
parent::__construct(
106107
uriTemplate: $uriTemplate,
@@ -182,6 +183,7 @@ class: $class,
182183
hideHydraOperation: $hideHydraOperation,
183184
jsonStream: $jsonStream,
184185
extraProperties: $extraProperties,
186+
map: $map
185187
);
186188
}
187189
}

src/Metadata/GetCollection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public function __construct(
102102
?bool $jsonStream = null,
103103
array $extraProperties = [],
104104
private ?string $itemUriTemplate = null,
105+
?bool $map = null,
105106
) {
106107
parent::__construct(
107108
uriTemplate: $uriTemplate,
@@ -183,6 +184,7 @@ class: $class,
183184
strictQueryParameterValidation: $strictQueryParameterValidation,
184185
hideHydraOperation: $hideHydraOperation,
185186
stateOptions: $stateOptions,
187+
map: $map
186188
);
187189
}
188190

src/Metadata/GraphQl/Operation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function __construct(
9292
mixed $rules = null,
9393
?string $policy = null,
9494
array $extraProperties = [],
95+
?bool $map = null,
9596
) {
9697
parent::__construct(
9798
shortName: $shortName,
@@ -141,7 +142,8 @@ class: $class,
141142
queryParameterValidationEnabled: $queryParameterValidationEnabled,
142143
rules: $rules,
143144
policy: $policy,
144-
extraProperties: $extraProperties
145+
extraProperties: $extraProperties,
146+
map: $map
145147
);
146148
}
147149

src/Metadata/GraphQl/Query.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public function __construct(
7777
array $extraProperties = [],
7878

7979
protected ?bool $nested = null,
80+
?bool $map = null,
8081
) {
8182
parent::__construct(
8283
resolver: $resolver,
@@ -132,7 +133,8 @@ class: $class,
132133
queryParameterValidationEnabled: $queryParameterValidationEnabled,
133134
policy: $policy,
134135
rules: $rules,
135-
extraProperties: $extraProperties
136+
extraProperties: $extraProperties,
137+
map: $map
136138
);
137139
}
138140

src/Metadata/GraphQl/Subscription.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function __construct(
7575
mixed $rules = null,
7676
?string $policy = null,
7777
array $extraProperties = [],
78+
?bool $map = null,
7879
) {
7980
parent::__construct(
8081
resolver: $resolver,
@@ -131,6 +132,7 @@ class: $class,
131132
policy: $policy,
132133
rules: $rules,
133134
extraProperties: $extraProperties,
135+
map: $map
134136
);
135137
}
136138
}

src/Metadata/HttpOperation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ public function __construct(
221221
?bool $queryParameterValidationEnabled = null,
222222
?bool $jsonStream = null,
223223
array $extraProperties = [],
224+
?bool $map = null,
224225
) {
225226
$this->formats = (null === $formats || \is_array($formats)) ? $formats : [$formats];
226227
$this->inputFormats = (null === $inputFormats || \is_array($inputFormats)) ? $inputFormats : [$inputFormats];
@@ -279,7 +280,8 @@ class: $class,
279280
strictQueryParameterValidation: $strictQueryParameterValidation,
280281
hideHydraOperation: $hideHydraOperation,
281282
jsonStream: $jsonStream,
282-
extraProperties: $extraProperties
283+
extraProperties: $extraProperties,
284+
map: $map
283285
);
284286
}
285287

src/Metadata/Metadata.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function __construct(
8181
protected ?bool $strictQueryParameterValidation = null,
8282
protected ?bool $hideHydraOperation = null,
8383
protected ?bool $jsonStream = null,
84+
protected ?bool $map = null,
8485
protected array $extraProperties = [],
8586
) {
8687
if (\is_array($parameters) && $parameters) {
@@ -90,6 +91,19 @@ public function __construct(
9091
$this->parameters = $parameters;
9192
}
9293

94+
public function canMap(): ?bool
95+
{
96+
return $this->map;
97+
}
98+
99+
public function withMap(bool $map): static
100+
{
101+
$self = clone $this;
102+
$self->map = $map;
103+
104+
return $self;
105+
}
106+
93107
public function getShortName(): ?string
94108
{
95109
return $this->shortName;

0 commit comments

Comments
 (0)