Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/State/Processor/ObjectMapperProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function process(mixed $data, Operation $operation, array $uriVariables =
$context,
);

// in some cases (delete operation), the decoration may return a null object
if (null === $persisted) {
return $persisted;
}

$request?->attributes->set('persisted_data', $persisted);

// return the Resource representation of the persisted entity
Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/MappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public function testShouldMapBetweenResourceAndEntity(): void

$r = self::createClient()->request('PATCH', $uri, ['json' => ['username' => 'ba zar'], 'headers' => ['content-type' => 'application/merge-patch+json']]);
$this->assertJsonContains(['username' => 'ba zar']);

$r = self::createClient()->request('DELETE', $uri);
$this->assertResponseStatusCodeSame(204);
}

public function testShouldMapToTheCorrectResource(): void
Expand Down
Loading