Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Mime][FormDataPart] Add support of multidimensional fields in constructor#33064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
wtorsi wants to merge1 commit intosymfony:4.3fromwtorsi:issue_33063

Conversation

@wtorsi
Copy link

QA
Branch?4.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#33063
LicenseMIT
Doc PR

Add support of multidimensional fields in FormDataPart.

@wtorsiwtorsi changed the titleIssue #33063[Mime][FormDataPart] Add support of multidimensional fields in constructorAug 8, 2019
@nicolas-grekasnicolas-grekas added this to the4.3 milestoneAug 8, 2019
@nicolas-grekasnicolas-grekas changed the base branch from4.4 to4.3August 8, 2019 17:09
@jvahldick
Copy link
Contributor

Hi,

First of all, thanks@wtorsi for your time taking a look on this issue.

I have a similar issue when trying toPOST arrays using the HttpClient component together with Mime. Let's say I am trying to send an array of tags for creating a media file.

$formFields = ['media' => ['tags' => [            ['name' =>'first-tag'            ],            ['name' =>'first-tag'            ]        ],    ],];

Using the PR code, as result, I have the following field names:

name=medianame=media

However, when sending a form-data, what I expect on the backend is something like:

name=media[tags][0][name]name=media[tags][1][name]

I changed a bit the closure function to have the result I was expecting, which I am not sure it is the correct way.

$prepare =function ($item,$key,$root =null)use (&$values, &$prepare) {$fieldName =$root ?$root .'['.$key.']' :$key;if (\is_array($item)) {array_walk($item,$prepare,$fieldName);return;    }$values[] =$this->preparePart($fieldName,$item);};

Any thoughts?

@fabpot
Copy link
Member

Closing as it seems to have been fixed by#34032

@fabpotfabpot closed thisAug 13, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@wtorsi@jvahldick@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp