Add user transformer for projects

This commit is contained in:
David Bomba 2025-08-14 07:23:53 +10:00
parent 564c2a1682
commit 2899d5fce2
1 changed files with 12 additions and 0 deletions

View File

@ -41,8 +41,20 @@ class ProjectTransformer extends EntityTransformer
'invoices', 'invoices',
'expenses', 'expenses',
'quotes', 'quotes',
'user',
]; ];
public function includeUser(Project $project): ?Item
{
$transformer = new UserTransformer($this->serializer);
if (!$project->user) { //@phpstan-ignore-line
return null;
}
return $this->includeItem($project->user, $transformer, User::class);
}
public function includeDocuments(Project $project) public function includeDocuments(Project $project)
{ {
$transformer = new DocumentTransformer($this->serializer); $transformer = new DocumentTransformer($this->serializer);