Skip to content

Introduce custom attributes for Responses #30578

@shyim

Description

@shyim

Description
The request object have attributes property where application can save custom informations. This possibility is missing on responses. (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L74)

I am migrating currently a project that uses ZF1 Request and Response object. The Response object has a method to set exceptions to this Response. Since I want to replace only the Request and Response object I have to support that also as Response object from the HttpFoundation.

So my idea was to add that property also to the Response object

I would also create a PR for that :)

Example

$response= new Response();
$response->attributes->set('something', true);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions