Skip to content

Commit

Permalink
Fix collection partials
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Aug 4, 2023
1 parent 5f56653 commit 0ea20b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Resolvers/TransformedDataCollectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Spatie\LaravelData\DataCollection;
use Spatie\LaravelData\PaginatedDataCollection;
use Spatie\LaravelData\Support\DataConfig;
use Spatie\LaravelData\Support\Transformation\PartialTransformationContext;
use Spatie\LaravelData\Support\Transformation\TransformationContext;
use Spatie\LaravelData\Support\Wrapping\Wrap;
use Spatie\LaravelData\Support\Wrapping\WrapExecutionType;
Expand Down Expand Up @@ -109,7 +110,12 @@ protected function transformationClosure(
return $data;
}

return app(TransformedDataResolver::class)->execute($data, $context);
$localPartials = PartialTransformationContext::create(
$data,
$data->getDataContext()->partialsDefinition
);

return app(TransformedDataResolver::class)->execute($data, $context->mergePartials($localPartials));
};
}
}

0 comments on commit 0ea20b3

Please sign in to comment.