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

Reworded the example about $deep param#6390

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

Merged
xabbuh merged 2 commits intosymfony:2.8fromjaviereguiluz:pr/6333
Mar 26, 2016
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Reworded the example about $deep param
  • Loading branch information
@javiereguiluz
javiereguiluz committedMar 20, 2016
commit09bc39e0f61a0fecc3e57be73ac1a3224f59b614
15 changes: 9 additions & 6 deletionscomponents/http_foundation/introduction.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -147,25 +147,28 @@ exist::
// the query string is '?foo=bar'

$request->query->get('foo');
// returns bar
// returns'bar'

$request->query->get('bar');
// returns null

$request->query->get('bar', 'bar');
// returns 'bar'
$request->query->get('bar', 'baz');
// returns 'baz'

When PHP imports the request query, it handles request parameters like
``foo[bar]=bar`` in a special way as it creates an array. So you can get the
``foo`` parameter and you will get back an array with a ``bar`` element::

// the query string is '?foo[bar]=bar'
// the query string is '?foo[bar]=baz'

$request->query->get('foo');
// returns array('bar' => 'bar')
// returns array('bar' => 'baz')

$request->query->get('foo[bar]');
// returns null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

the only thing I don't understand is why do you keep this example since the PropertyAccessor syntax isn't possible anymore (or just deprecated in 2.8) :)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

In this example the query string is?foo[bar]=baz That's why I suppose that most people will think thatfoo[bar] will returnbaz. It looks common sense! So putting this example and returningnull will make them realize that this doesn't work as they expect.

Oliboy50 reacted with thumbs up emoji

$request->query->get('foo')['bar'];
// returns 'bar'
// returns 'baz'

.. _component-foundation-attributes:

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp