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

Commit042b61e

Browse files
committed
Merge branch '2.1' into 2.2
2 parents2dae494 +360a202 commit042b61e

File tree

14 files changed

+114
-84
lines changed

14 files changed

+114
-84
lines changed

‎book/controller.rst

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -686,23 +686,19 @@ the ``notice`` message:
686686

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

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 %}
689+
{% for flashMessage in app.session.flashbag.get('notice') %}
690+
<div class="flash-notice">
691+
{{ flashMessage }}
692+
</div>
693+
{% endfor %}
696694

697695
..code-block::html+php
698696

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; ?>
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; ?>
706702

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

‎book/doctrine.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ and ``nullable``. Take a few examples:
14621462
<!--
14631463
A string field length 255 that cannot be null
14641464
(reflecting the default values for the "length" and *nullable* options)
1465-
type attribute is necessary inyaml definitions
1465+
type attribute is necessary inxml definitions
14661466
-->
14671467
<fieldname="name"type="string" />
14681468
<fieldname="email"

‎book/templating.rst

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,43 +1384,9 @@ in a JavaScript string, use the ``js`` context:
13841384
Debugging
13851385
---------
13861386

1387-
..versionadded::2.0.9
1388-
This feature is available as of Twig ``1.5.x``, which was first shipped
1389-
with Symfony 2.0.9.
1390-
13911387
When using PHP, you can use ``var_dump()`` if you need to quickly find the
13921388
value of a variable passed. This is useful, for example, inside your controller.
1393-
The same can be achieved when using Twig by using the debug extension. This
1394-
needs to be enabled in the config:
1395-
1396-
..configuration-block::
1397-
1398-
..code-block::yaml
1399-
1400-
# app/config/config.yml
1401-
services:
1402-
acme_hello.twig.extension.debug:
1403-
class:Twig_Extension_Debug
1404-
tags:
1405-
-{ name: 'twig.extension' }
1406-
1407-
..code-block::xml
1408-
1409-
<!-- app/config/config.xml-->
1410-
<services>
1411-
<serviceid="acme_hello.twig.extension.debug"class="Twig_Extension_Debug">
1412-
<tagname="twig.extension" />
1413-
</service>
1414-
</services>
1415-
1416-
..code-block::php
1417-
1418-
// app/config/config.php
1419-
use Symfony\Component\DependencyInjection\Definition;
1420-
1421-
$definition = new Definition('Twig_Extension_Debug');
1422-
$definition->addTag('twig.extension');
1423-
$container->setDefinition('acme_hello.twig.extension.debug', $definition);
1389+
The same can be achieved when using Twig thanks to the the debug extension.
14241390

14251391
Template parameters can then be dumped using the ``dump`` function:
14261392

‎components/config/definition.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ and sometimes only:
443443
444444
By default ``connection`` would be an array in the first case and a string
445445
in the second making it difficult to validate. You can ensure it is always
446-
an array withwith``fixXmlConfig``.
446+
an array with ``fixXmlConfig``.
447447

448448
You can further control the normalization process if you need to. For example,
449449
you may want to allow a string to be set and used as a particular key or several

‎components/event_dispatcher/container_aware_dispatcher.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Adding Subscriber Services
5959
``EventSubscribers`` can be added using the
6060
:method:`Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher::addSubscriberService`
6161
method where the first argument is the service ID of the subscriber service,
62-
and the second argument is thetheservice's class name (which must implement
62+
and the second argument is the service's class name (which must implement
6363
:class:`Symfony\\Component\\EventDispatcher\\EventSubscriberInterface`) as follows::
6464

6565
$dispatcher->addSubscriberService(

‎components/http_foundation/session_configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ examples if you wish to write your own.
7979
Example usage::
8080

8181
use Symfony\Component\HttpFoundation\Session\Session;
82-
use Symfony\Component\HttpFoundation\Session\Storage\SessionStorage;
82+
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
8383
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
8484

8585
$storage = new NativeSessionStorage(array(), new PdoSessionHandler());

‎components/http_foundation/sessions.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -333,16 +333,3 @@ 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-
}

‎cookbook/cache/varnish.rst

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ application:
3535
..code-block::text
3636
3737
sub vcl_recv {
38+
// Add a Surrogate-Capability header to announce ESI support.
3839
set req.http.Surrogate-Capability = "abc=ESI/1.0";
3940
}
4041
@@ -45,12 +46,16 @@ Symfony2 adds automatically:
4546
..code-block::text
4647
4748
sub vcl_fetch {
49+
/*
50+
Check for ESI acknowledgement
51+
and remove Surrogate-Control header
52+
*/
4853
if (beresp.http.Surrogate-Control ~ "ESI/1.0") {
4954
unset beresp.http.Surrogate-Control;
5055
51-
//for Varnish >= 3.0
56+
//For Varnish >= 3.0
5257
set beresp.do_esi = true;
53-
//for Varnish < 3.0
58+
//For Varnish < 3.0
5459
// esi;
5560
}
5661
}
@@ -75,14 +80,43 @@ that will invalidate the cache for a given resource:
7580

7681
..code-block::text
7782
83+
/*
84+
Connect to the backend server
85+
on the local machine on port 8080
86+
*/
87+
backend default {
88+
.host = "127.0.0.1";
89+
.port = "8080";
90+
}
91+
92+
sub vcl_recv {
93+
/*
94+
Varnish default behaviour doesn't support PURGE.
95+
Match the PURGE request and immediately do a cache lookup,
96+
otherwise Varnish will directly pipe the request to the backend
97+
and bypass the cache
98+
*/
99+
if (req.request == "PURGE") {
100+
return(lookup);
101+
}
102+
}
103+
78104
sub vcl_hit {
105+
// Match PURGE request
79106
if (req.request == "PURGE") {
107+
// Force object expiration for Varnish < 3.0
80108
set obj.ttl = 0s;
109+
// Do an actual purge for Varnish >= 3.0
110+
// purge;
81111
error 200 "Purged";
82112
}
83113
}
84114
85115
sub vcl_miss {
116+
/*
117+
Match the PURGE request and
118+
indicate the request wasn't stored in cache.
119+
*/
86120
if (req.request == "PURGE") {
87121
error 404 "Not purged";
88122
}
@@ -91,7 +125,56 @@ that will invalidate the cache for a given resource:
91125
..caution::
92126

93127
You must protect the ``PURGE`` HTTP method somehow to avoid random people
94-
purging your cached data.
128+
purging your cached data. You can do this by setting up an access list:
129+
130+
..code-block::text
131+
/*
132+
Connect to the backend server
133+
on the local machine on port 8080
134+
*/
135+
backend default {
136+
.host = "127.0.0.1";
137+
.port = "8080";
138+
}
139+
140+
// Acl's can contain IP's, subnets and hostnames
141+
acl purge {
142+
"localhost";
143+
"192.168.55.0"/24;
144+
}
145+
146+
sub vcl_recv {
147+
// Match PURGE request to avoid cache bypassing
148+
if (req.request == "PURGE") {
149+
// Match client IP to the acl
150+
if (!client.ip ~ purge) {
151+
// Deny access
152+
error 405 "Not allowed.";
153+
}
154+
// Perform a cache lookup
155+
return(lookup);
156+
}
157+
}
158+
159+
sub vcl_hit {
160+
// Match PURGE request
161+
if (req.request == "PURGE") {
162+
// Force object expiration for Varnish < 3.0
163+
set obj.ttl = 0s;
164+
// Do an actual purge for Varnish >= 3.0
165+
// purge;
166+
error 200 "Purged";
167+
}
168+
}
169+
170+
sub vcl_miss {
171+
// Match PURGE request
172+
if (req.request == "PURGE") {
173+
// Indicate that the object isn't stored in cache
174+
error 404 "Not purged";
175+
}
176+
}
177+
95178
96179
.. _`Edge Architecture`:http://www.w3.org/TR/edge-arch
97180
.. _`GZIP and Varnish`:https://www.varnish-cache.org/docs/3.0/phk/gzip.html

‎cookbook/console/sending_emails.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ How to generate URLs and send Emails from the Console
66
=====================================================
77

88
Unfortunately, the command line context does not know about your VirtualHost
9-
or domain name. This means that ififyou generate absolute URLs within a
9+
or domain name. This means that if you generate absolute URLs within a
1010
Console Command you'll probably end up with something like ``http://localhost/foo/bar``
1111
which is not very useful.
1212

‎cookbook/deployment-tools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The typical steps taken while deploying a Symfony2 application include:
2323

2424
A deployment may also include other things, such as:
2525

26-
* Tagging a particular version ofofyour code as a release in your source control repository;
26+
* Tagging a particular version of your code as a release in your source control repository;
2727
* Creating a temporary staging area to build your updated setup "offline";
2828
* Running any tests available to ensure code and/or server stability;
2929
* Removal of any unnecessary files from ``web`` to keep your production environment clean;

‎quick_tour/the_controller.rst

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

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

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

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

‎reference/constraints/Collection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ field is optional but must be a valid email if supplied, you can do the followin
226226
227227
Even without ``allowMissingFields`` set to true, you can now omit the ``alternate_email``
228228
property completely from the ``profileData`` array, since it is ``Optional``.
229-
However, if thethe``personal_email`` field does not exist in the array,
229+
However, if the ``personal_email`` field does not exist in the array,
230230
the ``NotBlank`` constraint will still be applied (since it is wrapped in
231231
``Required``) and you will receive a constraint violation.
232232

‎reference/constraints/Length.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To verify that the ``firstName`` field length of a class is between "2" and
3939
min:2
4040
max:50
4141
minMessage:"Your first name must be at least {{ limit }} characters length"
42-
maxMessage:"Your first name cannot be longer thanthan{{ limit }} characters length"
42+
maxMessage:"Your first name cannot be longer than {{ limit }} characters length"
4343
4444
..code-block::php-annotations
4545
@@ -55,7 +55,7 @@ To verify that the ``firstName`` field length of a class is between "2" and
5555
* min = "2",
5656
* max = "50",
5757
* minMessage = "Your first name must be at least {{ limit }} characters length",
58-
* maxMessage = "Your first name cannot be longer thanthan{{ limit }} characters length"
58+
* maxMessage = "Your first name cannot be longer than {{ limit }} characters length"
5959
* )
6060
*/
6161
protected $firstName;
@@ -70,7 +70,7 @@ To verify that the ``firstName`` field length of a class is between "2" and
7070
<optionname="min">2</option>
7171
<optionname="max">50</option>
7272
<optionname="minMessage">Your first name must be at least {{ limit }} characters length</option>
73-
<optionname="maxMessage">Your first name cannot be longer thanthan{{ limit }} characters length</option>
73+
<optionname="maxMessage">Your first name cannot be longer than {{ limit }} characters length</option>
7474
</constraint>
7575
</property>
7676
</class>
@@ -91,7 +91,7 @@ To verify that the ``firstName`` field length of a class is between "2" and
9191
'min' => 2,
9292
'max' => 50,
9393
'minMessage' => 'Your first name must be at least {{ limit }} characters length',
94-
'maxMessage' => 'Your first name cannot be longer thanthan{{ limit }} characters length',
94+
'maxMessage' => 'Your first name cannot be longer than {{ limit }} characters length',
9595
)));
9696
}
9797
}
@@ -121,7 +121,7 @@ charset
121121
**type**: ``string`` **default**: ``UTF-8``
122122

123123
The charset to be used when computing value's length. The:phpfunction:`grapheme_strlen` PHP
124-
function is used if available. If not, thethe:phpfunction:`mb_strlen` PHP function
124+
function is used if available. If not, the:phpfunction:`mb_strlen` PHP function
125125
is used if available. If neither are available, the:phpfunction:`strlen` PHP function
126126
is used.
127127

‎reference/forms/types/options/property_path.rst.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ name.
1212
1313
If you wish the field to be ignored when reading or writing to the object
1414
you can set the ``property_path`` option to ``false``, but using
15-
``property_path`` for this purpose is deprecated, you shoulddo itthe way
16-
described below:
15+
``property_path`` for this purpose is deprecated, you shouldusethe
16+
``mapped`` option.
1717
1818
.. versionadded:: 2.1
1919
Since 2.1, the ``mapped`` option has been added for this use-case.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp