getUser($request), $structuralElement)) { throw new AuthorizationFailedException(); } if ($structuralElement->image) { $structuralElement->image->getFileType()->delete(); } $structuralElement->image_id = null; $structuralElement->store(); return $response->withStatus(204); } }