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

Commit28b0904

Browse files
committed
Merge branch '2.1' into 2.2
2 parents880dd44 +9330ec2 commit28b0904

File tree

9 files changed

+93
-45
lines changed

9 files changed

+93
-45
lines changed

‎book/controller.rst

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ value to each variable.
476476

477477
Like other base ``Controller`` methods, the ``forward`` method is just
478478
a shortcut for core Symfony2 functionality. A forward can be accomplished
479-
directly via the ``http_kernel`` service. A forward returns a ``Response``
479+
directly via the ``http_kernel`` service and returns a ``Response``
480480
object::
481481

482482
$httpKernel = $this->container->get('http_kernel');
@@ -686,19 +686,23 @@ the ``notice`` message:
686686

687687
..code-block::html+jinja
688688

689-
{% for flashMessage in app.session.flashbag.get('notice') %}
690-
<div class="flash-notice">
691-
{{ flashMessage }}
692-
</div>
693-
{% endfor %}
689+
{% if app.session.started %}
690+
{% for flashMessage in app.session.flashbag.get('notice') %}
691+
<div class="flash-notice">
692+
{{ flashMessage }}
693+
</div>
694+
{% endfor %}
695+
{% endif %}
694696

695697
..code-block::html+php
696698

697-
<?php foreach ($view['session']->getFlashBag()->get('notice') as $message): ?>
698-
<div class="flash-notice">
699-
<?php echo "<div class='flash-error'>$message</div>" ?>
700-
</div>
701-
<?php endforeach; ?>
699+
<?php if ($view['session']->isStarted()): ?>
700+
<?php foreach ($view['session']->getFlashBag()->get('notice') as $message): ?>
701+
<div class="flash-notice">
702+
<?php echo "<div class='flash-error'>$message</div>" ?>
703+
</div>
704+
<?php endforeach; ?>
705+
<?php endif; ?>
702706

703707
By design, flash messages are meant to live for exactly one request (they're
704708
"gone in a flash"). They're designed to be used across redirects exactly as

‎book/stable_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ As of Symfony 2.0, the following components have a public tagged API:
3131
* DependencyInjection
3232
* DomCrawler
3333
* EventDispatcher
34+
* Filesystem (as of Symfony 2.1)
3435
* Finder
3536
* HttpFoundation
3637
* HttpKernel

‎components/filesystem.rst

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ endpoint for filesystem operations::
5151
Mkdir
5252
~~~~~
5353

54-
Mkdir creates directory. On posix filesystems, directories are created with a
55-
default mode value `0777`. You can use the second argument to set your own mode::
54+
:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` creates directory.
55+
On posix filesystems, directories are created with a default mode value
56+
`0777`. You can use the second argument to set your own mode::
5657

5758
$fs->mkdir('/tmp/photos', 0700);
5859

@@ -64,8 +65,8 @@ default mode value `0777`. You can use the second argument to set your own mode:
6465
Exists
6566
~~~~~~
6667

67-
Exists checks for the presence of all files or directories and returns false if a
68-
file is missing::
68+
:method:`Symfony\\Component\\Filesystem\\Filesystem::exists` checks for the
69+
presence of all files or directories and returns false if afile is missing::
6970

7071
// this directory exists, return true
7172
$fs->exists('/tmp/photos');
@@ -81,9 +82,10 @@ file is missing::
8182
Copy
8283
~~~~
8384

84-
This method is used to copy files. If the target already exists, the file is
85-
copied only if the source modification date is later than the target. This
86-
behavior can be overridden by the third boolean argument::
85+
:method:`Symfony\\Component\\Filesystem\\Filesystem::copy` is used to copy
86+
files. If the target already exists, the file is copied only if the source
87+
modification date is later than the target. This behavior can be overridden by
88+
the third boolean argument::
8789

8890
// works only if image-ICC has been modified after image.jpg
8991
$fs->copy('image-ICC.jpg', 'image.jpg');
@@ -94,9 +96,9 @@ behavior can be overridden by the third boolean argument::
9496
Touch
9597
~~~~~
9698

97-
Touch sets access and modification time for a file. The current time is used by
98-
default. You can set your own with the second argument. The third argument is
99-
the access time::
99+
:method:`Symfony\\Component\\Filesystem\\Filesystem::touch` sets access and
100+
modification time for a file. The current time is used by default. You can set
101+
your own with the second argument. The third argument isthe access time::
100102

101103
// set modification time to the current timestamp
102104
$fs->touch('file.txt');
@@ -113,8 +115,8 @@ the access time::
113115
Chown
114116
~~~~~
115117

116-
Chown is used to change the owner of a file. The third argument is a boolean
117-
recursive option::
118+
:method:`Symfony\\Component\\Filesystem\\Filesystem::chown` is used to change
119+
the owner of a file. The third argument is a booleanrecursive option::
118120

119121
// set the owner of the lolcat video to www-data
120122
$fs->chown('lolcat.mp4', 'www-data');
@@ -129,8 +131,8 @@ recursive option::
129131
Chgrp
130132
~~~~~
131133

132-
Chgrp is used to change the group of a file. The third argument is a boolean
133-
recursive option::
134+
:method:`Symfony\\Component\\Filesystem\\Filesystem::chgrp` is used to change
135+
the group of a file. The third argument is a booleanrecursive option::
134136

135137
// set the group of the lolcat video to nginx
136138
$fs->chgrp('lolcat.mp4', 'nginx');
@@ -146,8 +148,8 @@ recursive option::
146148
Chmod
147149
~~~~~
148150

149-
Chmod is used to change the mode of a file. The fourth argument is a boolean
150-
recursive option::
151+
:method:`Symfony\\Component\\Filesystem\\Filesystem::chmod` is used to change
152+
the mode of a file. The fourth argument is a booleanrecursive option::
151153

152154
// set the mode of the video to 0600
153155
$fs->chmod('video.ogg', 0600);
@@ -162,7 +164,8 @@ recursive option::
162164
Remove
163165
~~~~~~
164166

165-
Remove let's you remove files, symlink, directories easily::
167+
:method:`Symfony\\Component\\Filesystem\\Filesystem::remove` let's you remove
168+
files, symlink, directories easily::
166169

167170
$fs->remove(array('symlink', '/path/to/directory', 'activity.log'));
168171

@@ -174,7 +177,8 @@ Remove let's you remove files, symlink, directories easily::
174177
Rename
175178
~~~~~~
176179

177-
Rename is used to rename files and directories::
180+
:method:`Symfony\\Component\\Filesystem\\Filesystem::rename` is used to rename
181+
files and directories::
178182

179183
//rename a file
180184
$fs->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
@@ -184,8 +188,9 @@ Rename is used to rename files and directories::
184188
symlink
185189
~~~~~~~
186190

187-
Creates a symbolic link from the target to the destination. If the filesystem
188-
does not support symbolic links, a third boolean argument is available::
191+
:method:`Symfony\\Component\\Filesystem\\Filesystem::symlink` creates a
192+
symbolic link from the target to the destination. If the filesystem does not
193+
support symbolic links, a third boolean argument is available::
189194

190195
// create a symbolic link
191196
$fs->symlink('/path/to/source', '/path/to/destination');
@@ -196,7 +201,8 @@ does not support symbolic links, a third boolean argument is available::
196201
makePathRelative
197202
~~~~~~~~~~~~~~~~
198203

199-
Return the relative path of a directory given another one::
204+
:method:`Symfony\\Component\\Filesystem\\Filesystem::makePathRelative` returns
205+
the relative path of a directory given another one::
200206

201207
// returns '../'
202208
$fs->makePathRelative(
@@ -209,14 +215,16 @@ Return the relative path of a directory given another one::
209215
mirror
210216
~~~~~~
211217

212-
Mirrors a directory::
218+
:method:`Symfony\\Component\\Filesystem\\Filesystem::mirror` mirrors a
219+
directory::
213220

214221
$fs->mirror('/path/to/source', '/path/to/target');
215222

216223
isAbsolutePath
217224
~~~~~~~~~~~~~~
218225

219-
isAbsolutePath returns true if the given path is absolute, false otherwise::
226+
:method:`Symfony\\Component\\Filesystem\\Filesystem::isAbsolutePath` returns
227+
``true`` if the given path is absolute, false otherwise::
220228

221229
// return true
222230
$fs->isAbsolutePath('/tmp');
@@ -236,9 +244,9 @@ thrown.
236244

237245
..note::
238246

239-
Prior to version 2.1,:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir`
240-
returned a boolean and did not throwexceptions. As of 2.1, a
241-
:class:`Symfony\\Component\\Filesystem\\Exception\\IOException` is
242-
thrownif a directory creation fails.
247+
Prior to version 2.1,``mkdir`` returned a boolean and did not throw
248+
exceptions. As of 2.1, a
249+
:class:`Symfony\\Component\\Filesystem\\Exception\\IOException` is thrown
250+
if a directory creation fails.
243251

244252
.. _`Packagist`:https://packagist.org/packages/symfony/filesystem

‎components/http_foundation/sessions.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,16 @@ Compact method to process display all flashes at once::
333333
echo "<div class='flash-$type'>$message</div>\n";
334334
}
335335
}
336+
337+
..caution::
338+
339+
As flash messages use a session to store the messages from one request to
340+
the next one, a session will be automatically started when you read the
341+
flash messages even if none already exists. To avoid that default
342+
behavior, test if there is an existing session first::
343+
344+
if ($session->isStarted()) {
345+
foreach ($session->getFlashBag()->get('warning', array()) as $message) {
346+
echo "<div class='flash-warning'>$message</div>";
347+
}
348+
}

‎components/http_kernel/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ a built-in ControllerResolver that can be used to create a working example::
614614
'_controller' => function (Request $request) {
615615
return new Response(sprintf("Hello %s", $request->get('name')));
616616
}
617-
),
617+
)
618618
));
619619

620620
$request = Request::createFromGlobals();

‎components/security/authentication.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ from the user data storage, hash the password the user has just provided
119119
the given password is valid.
120120

121121
This functionality is offered by the:class:`Symfony\\Component\\Security\\Core\\Authentication\\Provider\\DaoAuthenticationProvider`.
122-
It fetches the user's data from a:class:`Symfony\\Component\\Security\\Core\\User\\UserProviderInterface``,
122+
It fetches the user's data from a:class:`Symfony\\Component\\Security\\Core\\User\\UserProviderInterface`,
123123
uses a:class:`Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface`
124124
to create a hash of the password and returns an authenticated token if the
125125
password was valid::

‎cookbook/security/target_path.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Next, create your own ``ExceptionListener``::
6262
return;
6363
}
6464

65-
$request->getSession()->set('_security.main.target_path',$request->getUri());
65+
parent::setTargetPath($request);
6666
}
6767
}
6868

69-
Add as much or few logic here as required for your scenario!
69+
Add as much or few logic here as required for your scenario!

‎quick_tour/the_controller.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ next request::
141141

142142
// display any messages back in the next request (in a template)
143143

144-
{% for flashMessage in app.session.flashbag.get('notice') %}
145-
<div>{{ flashMessage }}</div>
146-
{% endfor %}
144+
{% if app.session.started %}
145+
{% for flashMessage in app.session.flashbag.get('notice') %}
146+
<div>{{ flashMessage }}</div>
147+
{% endfor %}
148+
{% endif %}
147149

148150
This is useful when you need to set a success message before redirecting
149151
the user to another page (which will then show the message). Please note that

‎reference/dic_tags.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ may also be tags in other bundles you use that aren't listed here.
3131
+-----------------------------------+---------------------------------------------------------------------------+
3232
| `data_collector`_| Create a class that collects custom data for the profiler|
3333
+-----------------------------------+---------------------------------------------------------------------------+
34+
| `doctrine.event_listener`_| Add a Doctrine event listener|
35+
+-----------------------------------+---------------------------------------------------------------------------+
36+
| `doctrine.event_subscriber`_| Add a Doctrine event subscriber|
37+
+-----------------------------------+---------------------------------------------------------------------------+
3438
| `form.type`_| Create a custom form field type|
3539
+-----------------------------------+---------------------------------------------------------------------------+
3640
| `form.type_extension`_| Create a custom "form extension"|
@@ -235,6 +239,22 @@ data_collector
235239
For details on creating your own custom data collection, read the cookbook
236240
article: :doc:`/cookbook/profiler/data_collector`.
237241
242+
doctrine.event_listener
243+
--------------
244+
245+
**Purpose**: Add a Doctrine event listener
246+
247+
For details on creating Doctrine event listeners, read the cookbook article:
248+
:doc:`/cookbook/doctrine/event_listeners_subscribers`.
249+
250+
doctrine.event_subscriber
251+
--------------
252+
253+
**Purpose**: Add a Doctrine event subscriber
254+
255+
For details on creating Doctrine event subscribers, read the cookbook article:
256+
:doc:`/cookbook/doctrine/event_listeners_subscribers`.
257+
238258
.. _dic-tags-form-type:
239259
240260
form.type

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp