Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RequestDataObject as in java springΒ #46991

Closed
@dozsan

Description

@dozsan

Description

As it is included in FOSRest and ApiPlatfom, I would be happy if there was a native symfony component. Actually, the main point is to be able to create a RequestDataObject from the Request with the help of a serializer. Of course, it can also be projected now, but all of them are external packages.

Example

POST: /foo/bar/{barId}?status=active

{
    "id": 1,
    "name": "Name"
}

FooBarRequestData:

class FooBarRequestData {
    private int $barId;
    private string $status;
    private int $id;
    private string $name;

    /**
     * @return int
     */
    public function getBarId(): int
    {
        return $this->barId;
    }

    /**
     * @return string
     */
    public function getStatus(): string
    {
        return $this->status;
    }

    /**
     * @return int
     */
    public function getId(): int
    {
        return $this->id;
    }

    /**
     * @return string
     */
    public function getName(): string
    {
        return $this->name;
    }
}

Serialize an Object from the Symfony Request data

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions