First to Site
Release 3.4

Ordering Attachment Delete Routing

Fixed API Platform operation method resolution for attachment deletion in 3.4.0

Overview

v3.4.0 corrected the V3 Ordering API's attachment delete routing. DELETE requests were silently falling through to the POST handler, causing deletes to fail.

The Problem

ProjectOrderAttachmentProcessor.php determined the HTTP method by reading $context['request_method'], which could be missing or unreliable in certain API Platform contexts. When a DELETE operation was dispatched, the context key might not correctly reflect the method, causing the processor to default to 'POST' and never reach the delete logic branch.

The Fix

A single-line change replaced:

$method = $context['request_method'] ?? 'POST';

with:

$method = strtoupper((string) ($operation->getMethod() ?? $context['request_method'] ?? ''));

This reads the HTTP method from the API Platform $operation object first (via ->getMethod()), which is the canonical source for which operation is being executed. It falls back to $context['request_method'] only if the operation does not provide a method, and defaults to an empty string rather than 'POST'. The result is normalized with strtoupper() for safe comparison.

Files Touched

FileChange
ApiResource/Ordering/Processor/ProjectOrderAttachmentProcessor.phpModified - 1 line

Changelog Reference

  • fix(v3-ordering): use operation method for attachment delete routing (#650)