Skip to content

Commit

Permalink
Small fixes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Oct 13, 2023
1 parent d56e076 commit c02fbfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/advanced-usage/get-data-from-a-class-quickly.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SongController
{
$data = $request->getData();

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

return $data;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Resolvers/TransformedDataResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ private function transform(BaseData&TransformableData $data, TransformationConte
return $payload;
}

if ($property->type->isOptional && ! isset($data->{$name})) {
return $payload;
}

if (! $this->shouldIncludeProperty($name, $data->{$name}, $context)) {
return $payload;
}
Expand Down

0 comments on commit c02fbfa

Please sign in to comment.