2

I'm trying to set up my own request which I could send to a method for testing purposes, but I can't seem to find how to format it.

Right now I'm trying to pull array out of the request

$data = $request->request->get('itemData');

It should look like this once I get it:

[ 
    'basic' => [
        'type'   => 1
        'country => 1
    ],
    'information' => [
        'wadding' => 1
    ]
]

I have written it like this:

$request->request->set("itemData[basic][type]", 2);
$request->request->set("itemData[information][wadding]", 0);

But I get null since the key is not itemData but for example itemData[basic][type]

How do I format it in the set command so the request parameters are sent in array form?

1 Answer 1

3

Figured it out

$request->request->set("itemData",
    [
    'basic'       => ['type' => 2, 'country' => 1],
    'information' => ['wadding' => 0]
    ]
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.