Skip to content

Commit c02fbfa

Browse files
Small fixes after merge
1 parent d56e076 commit c02fbfa

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/advanced-usage/get-data-from-a-class-quickly.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SongController
4646
{
4747
$data = $request->getData();
4848

49-
$song = Song::create($data);
49+
$song = Song::create($data->toArray());
5050

5151
return $data;
5252
}

src/Resolvers/TransformedDataResolver.php

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ private function transform(BaseData&TransformableData $data, TransformationConte
5959
return $payload;
6060
}
6161

62+
if ($property->type->isOptional && ! isset($data->{$name})) {
63+
return $payload;
64+
}
65+
6266
if (! $this->shouldIncludeProperty($name, $data->{$name}, $context)) {
6367
return $payload;
6468
}

0 commit comments

Comments
 (0)