Skip to content

ObjectMapperProcessor fails for a DELETE operation #7434

@thomas-hiron

Description

@thomas-hiron

API Platform version(s) affected: 4.2.0

Description
With an API resource that has a Delete operation, the ObjectMapperProcessor errors on line 46, as the processed entity is removed by Doctrine.

$this->decorated->process($this->objectMapper->map($data), $operation, $uriVariables, $context), which is processed by RemoveProcessor, returns nothing.
The mapper fails here: https://github.com/api-platform/core/blob/4.2/src/State/Processor/ObjectMapperProcessor.php#L46

How to reproduce

#[Delete(uriTemplate: '/users/{uuid}')]
#[Map]
class UserResource
{}

Possible Solution
Test the output of the processor?

Additional Context

ApiPlatform\\State\\ObjectMapper\\ObjectMapper::map(): Argument #1 ($source) must be of type object, null given, called in /app/vendor/api-platform/core/src/State/Processor/ObjectMapperProcessor.php on line 46

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions