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

Appearance settings

Commit 42c7ea8

Browse filesBrowse files
committed
Merge branch '3.1' into 3.2
* 3.1: [#7427] fix line length Add apcu cache driver to doctrine config reference Change type of arguments min and max [#7383] minor rewording Added a note about not using the ClassLoader component Update guard_authentication.rst More clear description of factory service creation [#7376] minor wording improvement Added a tip about the expanded YAML syntax Added a minor help note about Request::setTrustedProxies Fix Apache 2.4 UDS instructions remove unused options parameter from loadManifest See #7362 bundles/override > Rewrite translations block
2 parents ea54460 + a638610 commit 42c7ea8
Copy full SHA for 42c7ea8

File tree

10 files changed

+136
-49
lines changed
Filter options

10 files changed

+136
-49
lines changed

‎bundles/override.rst

Copy file name to clipboardExpand all lines: bundles/override.rst
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,11 @@ can override the translations from any translation file, as long as it is in
154154

155155
.. caution::
156156

157-
The last translation file always wins. That means that you need to make
158-
sure that the bundle containing *your* translations is loaded after any
157+
Translation files are not aware of :doc:`bundle inheritance </bundles/inheritance>`.
158+
If you want to override translations from the parent bundle or another bundle,
159+
make sure that the bundle containing *your* translations is loaded after any
159160
bundle whose translations you're overriding. This is done in ``AppKernel``.
160161

161-
Translation files are also not aware of :doc:`bundle inheritance </bundles/inheritance>`.
162-
If you want to override translations from the parent bundle, be sure that the
163-
parent bundle is loaded before the child bundle in the ``AppKernel`` class.
164-
165-
The file that always wins is the one that is placed in
166-
``app/Resources/translations``, as those files are always loaded last.
162+
Finally, translations located in ``app/Resources/translations`` will override
163+
all the other translations since those files are always loaded last.
167164
.. _`the Doctrine documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#overrides

‎components/class_loader.rst

Copy file name to clipboardExpand all lines: components/class_loader.rst
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ The ClassLoader Component
77
The ClassLoader component provides tools to autoload your classes and
88
cache their locations for performance.
99

10+
.. caution::
11+
12+
The ClassLoader component was deprecated in Symfony 3.3 and it will be
13+
removed in 4.0. As an alternative, use Composer's class loading mechanism.
14+
1015
Usage
1116
-----
1217

‎components/http_foundation/trusting_proxies.rst

Copy file name to clipboardExpand all lines: components/http_foundation/trusting_proxies.rst
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@ the actual host may be stored in an ``X-Forwarded-Host`` header.
1717

1818
Since HTTP headers can be spoofed, Symfony does *not* trust these proxy
1919
headers by default. If you are behind a proxy, you should manually whitelist
20-
your proxy.
20+
your proxy as follows:
2121

2222
.. code-block:: php
2323
2424
use Symfony\Component\HttpFoundation\Request;
2525
26-
// only trust proxy headers coming from this IP addresses
26+
// put this code as early as possible in your application (e.g. in your
27+
// front controller) to only trust proxy headers coming from these IP addresses
2728
Request::setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));
2829
30+
.. versionadded:: 2.3
31+
CIDR notation support was introduced in Symfony 2.3, so you can whitelist whole
32+
subnets (e.g. ``10.0.0.0/8``, ``fc00::/7``).
33+
2934
You should also make sure that your proxy filters unauthorized use of these
3035
headers, e.g. if a proxy natively uses the ``X-Forwarded-For`` header, it
3136
should not allow clients to send ``Forwarded`` headers to Symfony.

‎frontend/custom_version_strategy.rst

Copy file name to clipboardExpand all lines: frontend/custom_version_strategy.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ version string::
100100
return $versionized;
101101
}
102102

103-
private function loadManifest(array $options)
103+
private function loadManifest()
104104
{
105105
return json_decode(file_get_contents($this->manifestPath), true);
106106
}

‎reference/configuration/doctrine.rst

Copy file name to clipboardExpand all lines: reference/configuration/doctrine.rst
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,9 @@ certain classes, but those are for very advanced use-cases only.
297297
Caching Drivers
298298
~~~~~~~~~~~~~~~
299299

300-
For the caching drivers you can specify the values ``array``, ``apc``, ``memcache``,
301-
``memcached``, ``redis``, ``wincache``, ``zenddata``, ``xcache`` or ``service``.
300+
For the caching drivers you can specify the values ``array``, ``apc``, ``apcu``,
301+
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata``, ``xcache``
302+
or ``service``.
302303

303304
The following example shows an overview of the caching configurations:
304305

‎reference/constraints/Count.rst

Copy file name to clipboardExpand all lines: reference/constraints/Count.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ you might add the following:
3838
{
3939
/**
4040
* @Assert\Count(
41-
* min = "1",
42-
* max = "5",
41+
* min = 1,
42+
* max = 5,
4343
* minMessage = "You must specify at least one email",
4444
* maxMessage = "You cannot specify more than {{ limit }} emails"
4545
* )

‎security/guard_authentication.rst

Copy file name to clipboardExpand all lines: security/guard_authentication.rst
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,10 @@ Frequently Asked Questions
502502
logout: ~
503503
504504
guard:
505+
entry_point: app.form_login_authenticator
505506
authenticators:
506507
- app.token_authenticator
508+
- app.form_login_authenticator
507509
508510
# if you want, disable storing the user in the session
509511
# stateless: true
@@ -529,8 +531,9 @@ Frequently Asked Questions
529531
>
530532
<logout />
531533
532-
<guard>
534+
<guard entry-point="app.form_login_authenticator">
533535
<authenticator>app.token_authenticator</authenticator>
536+
<authenticator>app.form_login_authenticator</authenticator>
534537
</guard>
535538
536539
<!-- ... -->
@@ -551,8 +554,10 @@ Frequently Asked Questions
551554
'anonymous' => true,
552555
'logout' => true,
553556
'guard' => array(
557+
'entry_point' => 'app.form_login_authenticator',
554558
'authenticators' => array(
555-
'app.token_authenticator'
559+
'app.token_authenticator',
560+
'app.form_login_authenticator',
556561
),
557562
),
558563
// ...

‎service_container.rst

Copy file name to clipboardExpand all lines: service_container.rst
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,29 @@ Injecting the dependency by the setter method just needs a change of syntax:
456456
and "setter injection". The Symfony service container also supports
457457
"property injection".
458458

459+
.. tip::
460+
461+
The YAML configuration format supports an expanded syntax which may be
462+
useful when the YAML contents are long and complex:
463+
464+
.. code-block:: yaml
465+
466+
# app/config/services.yml
467+
services:
468+
# traditional syntax
469+
app.newsletter_manager:
470+
class: AppBundle\Newsletter\NewsletterManager
471+
calls:
472+
- [setMailer, ['@app.mailer']]
473+
474+
# expanded syntax
475+
app.newsletter_manager:
476+
class: AppBundle\Newsletter\NewsletterManager
477+
calls:
478+
- method: setMailer
479+
arguments:
480+
- '@app.mailer'
481+
459482
Learn more
460483
----------
461484

‎service_container/factories.rst

Copy file name to clipboardExpand all lines: service_container/factories.rst
+78-27Lines changed: 78 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ the service container to call a method on the factory rather than directly
1313
instantiating the class.
1414

1515
Suppose you have a factory that configures and returns a new ``NewsletterManager``
16-
object::
16+
object by calling the static ``createNewsletterManager()`` method::
1717

18-
class NewsletterManagerFactory
18+
class NewsletterManagerStaticFactory
1919
{
2020
public static function createNewsletterManager()
2121
{
@@ -29,45 +29,98 @@ object::
2929

3030
To make the ``NewsletterManager`` object available as a service, you can
3131
configure the service container to use the
32-
``NewsletterManagerFactory::createNewsletterManager()`` factory method:
32+
``NewsletterManagerStaticFactory::createNewsletterManager()`` factory method:
3333

3434
.. configuration-block::
3535

3636
.. code-block:: yaml
3737
38+
# app/config/services.yml
39+
3840
services:
3941
app.newsletter_manager:
4042
class: AppBundle\Email\NewsletterManager
41-
# call a static method
42-
factory: ['AppBundle\Email\NewsletterManager', create]
43+
# call the static method
44+
factory: ['AppBundle\Email\NewsletterManagerStaticFactory', createNewsletterManager]
45+
46+
.. code-block:: xml
47+
48+
<!-- app/config/services.xml -->
49+
50+
<?xml version="1.0" encoding="UTF-8" ?>
51+
<container xmlns="http://symfony.com/schema/dic/services"
52+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
53+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
54+
55+
<services>
56+
<service id="app.newsletter_manager" class="AppBundle\Email\NewsletterManager">
57+
<!-- call the static method -->
58+
<factory class="AppBundle\Email\NewsletterManagerStaticFactory" method="createNewsletterManager" />
59+
</service>
60+
</services>
61+
</container>
62+
63+
.. code-block:: php
64+
65+
// app/config/services.php
66+
67+
use AppBundle\Email\NewsletterManager;
68+
use AppBundle\Email\NewsletterManagerStaticFactory;
69+
use Symfony\Component\DependencyInjection\Definition;
70+
// ...
71+
72+
$definition = new Definition(NewsletterManager::class);
73+
// call the static method
74+
$definition->setFactory(array(NewsletterManagerStaticFactory::class, 'createNewsletterManager'));
75+
76+
$container->setDefinition('app.newsletter_manager', $definition);
77+
78+
.. note::
79+
80+
When using a factory to create services, the value chosen for the ``class``
81+
option has no effect on the resulting service. The actual class name
82+
only depends on the object that is returned by the factory. However,
83+
the configured class name may be used by compiler passes and therefore
84+
should be set to a sensible value.
85+
86+
If your factory is not using a static function to configure and create your
87+
service, but a regular method, you can instantiate the factory itself as a
88+
service too. Later, in the ":ref:`factories-passing-arguments-factory-method`"
89+
section, you learn how you can inject arguments in this method.
90+
91+
Configuration of the service container then looks like this:
92+
93+
.. configuration-block::
94+
95+
.. code-block:: yaml
4396
97+
# app/config/services.yml
98+
99+
services:
44100
app.newsletter_manager_factory:
45101
class: AppBundle\Email\NewsletterManagerFactory
46102
47103
app.newsletter_manager:
48104
class: AppBundle\Email\NewsletterManager
49-
# call a method on the specified service
105+
# call a method on the specified factory service
50106
factory: 'app.newsletter_manager_factory:createNewsletterManager'
51107
52108
.. code-block:: xml
53109
110+
<!-- app/config/services.xml -->
111+
54112
<?xml version="1.0" encoding="UTF-8" ?>
55113
<container xmlns="http://symfony.com/schema/dic/services"
56114
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
57115
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
58116
59117
<services>
60-
<service id="app.newsletter_manager" class="AppBundle\Email\NewsletterManager">
61-
<!-- call a static method -->
62-
<factory class="AppBundle\Email\NewsletterManager" method="create" />
63-
</service>
64-
65118
<service id="app.newsletter_manager_factory"
66119
class="AppBundle\Email\NewsletterManagerFactory"
67120
/>
68121
69122
<service id="app.newsletter_manager" class="AppBundle\Email\NewsletterManager">
70-
<!-- call a method on the specified service -->
123+
<!-- call a method on the specified factory service -->
71124
<factory service="app.newsletter_manager_factory"
72125
method="createNewsletterManager"
73126
/>
@@ -77,50 +130,42 @@ configure the service container to use the
77130
78131
.. code-block:: php
79132
133+
// app/config/services.php
134+
80135
use AppBundle\Email\NewsletterManager;
81136
use AppBundle\Email\NewsletterManagerFactory;
82137
use Symfony\Component\DependencyInjection\Definition;
83138
// ...
84139
85-
$definition = new Definition(NewsletterManager::class);
86-
// call a static method
87-
$definition->setFactory(array(NewsletterManager::class, 'create'));
88-
89-
$container->setDefinition('app.newsletter_manager', $definition);
90-
91140
$container->register('app.newsletter_manager_factory', NewsletterManagerFactory::class);
92141
93142
$newsletterManager = new Definition(NewsletterManager::class);
94143
95-
// call a method on the specified service
144+
// call a method on the specified factory service
96145
$newsletterManager->setFactory(array(
97146
new Reference('app.newsletter_manager_factory'),
98147
'createNewsletterManager'
99148
));
100149
101150
$container->setDefinition('app.newsletter_manager', $newsletterManager);
102151
103-
.. note::
104-
105-
When using a factory to create services, the value chosen for the ``class``
106-
option has no effect on the resulting service. The actual class name
107-
only depends on the object that is returned by the factory. However,
108-
the configured class name may be used by compiler passes and therefore
109-
should be set to a sensible value.
110-
111152
.. note::
112153

113154
The traditional configuration syntax in YAML files used an array to define
114155
the factory service and the method name:
115156

116157
.. code-block:: yaml
117158
159+
# app/config/services.yml
160+
118161
app.newsletter_manager:
119162
# new syntax
120163
factory: 'app.newsletter_manager_factory:createNewsletterManager'
121164
# old syntax
122165
factory: ['@app.newsletter_manager_factory', createNewsletterManager]
123166
167+
.. _factories-passing-arguments-factory-method:
168+
124169
Passing Arguments to the Factory Method
125170
---------------------------------------
126171

@@ -132,6 +177,8 @@ method in the previous example takes the ``templating`` service as an argument:
132177

133178
.. code-block:: yaml
134179
180+
# app/config/services.yml
181+
135182
services:
136183
# ...
137184
@@ -142,6 +189,8 @@ method in the previous example takes the ``templating`` service as an argument:
142189
143190
.. code-block:: xml
144191
192+
<!-- app/config/services.xml -->
193+
145194
<?xml version="1.0" encoding="UTF-8" ?>
146195
<container xmlns="http://symfony.com/schema/dic/services"
147196
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -159,6 +208,8 @@ method in the previous example takes the ``templating`` service as an argument:
159208
160209
.. code-block:: php
161210
211+
// app/config/services.php
212+
162213
use AppBundle\Email\NewsletterManager;
163214
use Symfony\Component\DependencyInjection\Reference;
164215
use Symfony\Component\DependencyInjection\Definition;

‎setup/web_server_configuration.rst

Copy file name to clipboardExpand all lines: setup/web_server_configuration.rst
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,9 @@ Using mod_proxy_fcgi with Apache 2.4
162162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163163

164164
If you are running Apache 2.4, you can easily use ``mod_proxy_fcgi`` to pass
165-
incoming requests to PHP-FPM. Configure PHP-FPM to listen on a TCP socket
166-
(``mod_proxy`` currently `does not support Unix sockets`_), enable ``mod_proxy``
167-
and ``mod_proxy_fcgi`` in your Apache configuration and use the ``SetHandler``
168-
directive to pass requests for PHP files to PHP FPM:
165+
incoming requests to PHP-FPM. Configure PHP-FPM to listen on a TCP or Unix socket,
166+
enable ``mod_proxy`` and ``mod_proxy_fcgi`` in your Apache configuration, and
167+
use the ``SetHandler`` directive to pass requests for PHP files to PHP FPM:
169168

170169
.. code-block:: apache
171170
@@ -183,6 +182,8 @@ directive to pass requests for PHP files to PHP FPM:
183182
# with mod_rewrite or mod_autoindex
184183
<FilesMatch \.php$>
185184
SetHandler proxy:fcgi://127.0.0.1:9000
185+
# for Unix sockets, Apache 2.4.10 or higher
186+
# SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy
186187
</FilesMatch>
187188
188189
# If you use Apache version below 2.4.9 you must consider update or use this instead
@@ -338,6 +339,5 @@ The **minimum configuration** to get your application running under Nginx is:
338339
For advanced Nginx configuration options, read the official `Nginx documentation`_.
339340

340341
.. _`Apache documentation`: http://httpd.apache.org/docs/
341-
.. _`does not support Unix sockets`: https://bz.apache.org/bugzilla/show_bug.cgi?id=54101
342342
.. _`FastCgiExternalServer`: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer
343343
.. _`Nginx documentation`: http://wiki.nginx.org/Symfony

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.