Skip to content

Commit 7c35879

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents a299c16 + c7af8cf commit 7c35879

File tree

118 files changed

+1263
-638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1263
-638
lines changed

_build/_theme/_templates/layout.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{% extends '!layout.html' %}
22

3-
{% set css_files = ['http://symfony.com/css/compiled/v5/all.css?v=4'] %}
3+
{% set css_files = ['https://symfony.com/css/compiled/v5/all.css?v=4'] %}
44
{# make sure the Sphinx stylesheet isn't loaded #}
55
{% set style = '' %}
66
{% set isIndex = pagename is index %}
77

88
{% block extrahead %}
99
{# add JS to support tabs #}
10-
<script src="http://symfony.com/js/v5/all.js?v=4"></script>
10+
<script src="https://symfony.com/js/v5/all.js?v=4"></script>
1111

1212
{# pygment's styles are still loaded, undo some unwanted styles #}
1313
<style>
@@ -48,7 +48,7 @@ <h4>Pull request build</h4>
4848
<p>Each pull request of the Symfony Documentation is automatically deployed and hosted on <a href="https://platform.sh">Platform.sh</a>.<br>
4949
View this page on <a href="https://symfony.com/doc/current/{{ pagename }}">symfony.com</a>.</p>
5050
</div>
51-
51+
5252
{%- include "globaltoc.html" %}
5353

5454
{% if not isIndex %}
@@ -81,7 +81,7 @@ <h1 class="content_title">{{ title }}</h1>
8181
<a href="{{ next.link|e }}">{{ next.title|striptags|e }} »</a>
8282
</div>
8383
{% endif %}
84-
84+
8585
<div id="license">
8686
<p>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">License</a>.</p>
8787
</div>
49.9 KB
Loading
-43.1 KB
Binary file not shown.

best_practices/security.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,15 @@ more advanced use-case, you can always do the same security check in PHP:
235235
236236
if (!$post->isAuthor($this->getUser())) {
237237
$this->denyAccessUnlessGranted('edit', $post);
238-
239-
// or without the shortcut:
240-
//
241-
// use Symfony\Component\Security\Core\Exception\AccessDeniedException;
242-
// ...
243-
//
244-
// if (!$this->get('security.authorization_checker')->isGranted('edit', $post)) {
245-
// throw $this->createAccessDeniedException();
246-
// }
247238
}
239+
// equivalent code without using the "denyAccessUnlessGranted()" shortcut:
240+
//
241+
// use Symfony\Component\Security\Core\Exception\AccessDeniedException;
242+
// ...
243+
//
244+
// if (!$this->get('security.authorization_checker')->isGranted('edit', $post)) {
245+
// throw $this->createAccessDeniedException();
246+
// }
248247
249248
// ...
250249
}
@@ -398,6 +397,6 @@ If your company uses a user login method not supported by Symfony, you can
398397
develop :doc:`your own user provider </security/custom_provider>` and
399398
:doc:`your own authentication provider </security/custom_authentication_provider>`.
400399

401-
.. _`ParamConverter`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
402-
.. _`@Security annotation`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html
400+
.. _`ParamConverter`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
401+
.. _`@Security annotation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html
403402
.. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle

bundles/configuration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ bundle configuration would look like:
8383
<?xml version="1.0" ?>
8484
8585
<container xmlns="http://symfony.com/schema/dic/services"
86-
xmlns:acme-social="http://example.org/dic/schema/acme_social"
86+
xmlns:acme-social="http://example.org/schema/dic/acme_social"
8787
xsi:schemaLocation="http://symfony.com/schema/dic/services
8888
http://symfony.com/schema/dic/services/services-1.0.xsd">
8989
@@ -325,7 +325,7 @@ configuration of a specific bundle. The namespace is returned from the
325325
:method:`Extension::getNamespace() <Symfony\\Component\\DependencyInjection\\Extension\\Extension::getNamespace>`
326326
method. By convention, the namespace is a URL (it doesn't have to be a valid
327327
URL nor does it need to exists). By default, the namespace for a bundle is
328-
``http://example.org/dic/schema/DI_ALIAS``, where ``DI_ALIAS`` is the DI alias of
328+
``http://example.org/schema/dic/DI_ALIAS``, where ``DI_ALIAS`` is the DI alias of
329329
the extension. You might want to change this to a more professional URL::
330330

331331
// src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php

bundles/installation.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ The output will look like this:
133133
node_paths: []
134134
# ...
135135
136+
.. tip::
137+
138+
For complex bundles that define lots of configuration options, you can pass
139+
a second optional argument to the ``config:dump-reference`` command to only
140+
display a section of the entire configuration:
141+
142+
.. code-block:: terminal
143+
144+
$ bin/console config:dump-reference AsseticBundle use_controller
145+
146+
# Default configuration for "AsseticBundle" at path "use_controller"
147+
use_controller:
148+
enabled: '%kernel.debug%'
149+
profiler: false
150+
136151
Other Setup
137152
-----------
138153

bundles/override.rst

Lines 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/browser_kit.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ into the client constructor::
188188
$cookieJar = new Cookie('flavor', 'chocolate', strtotime('+1 day'));
189189

190190
// create a client and set the cookies
191-
$client = new Client(array(), array(), $cookieJar);
191+
$client = new Client(array(), null, $cookieJar);
192192
// ...
193193

194194
History

components/cache.rst

Lines changed: 123 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
The Cache Component
77
===================
88

9-
The Cache component provides an extended `PSR-6`_ implementation for adding
10-
cache to your applications. It is designed to have a low overhead and it
11-
ships with ready to use adapters for the most common caching backends.
9+
The Cache component provides an extended `PSR-6`_ implementation as well as
10+
a `PSR-16`_ "Simple Cache" implementation for adding cache to your applications.
11+
It is designed to have a low overhead and it ships with ready to use adapters
12+
for the most common caching backends.
1213

1314
.. versionadded:: 3.1
1415
The Cache component was introduced in Symfony 3.1.
1516

17+
.. versionadded:: 3.3
18+
The PSR-16 "Simple Cache" implementation was introduced in Symfony 3.3.
19+
1620
Installation
1721
------------
1822

@@ -21,11 +25,113 @@ You can install the component in 2 different ways:
2125
* :doc:`Install it via Composer </components/using_components>` (``symfony/cache`` on `Packagist`_);
2226
* Use the official Git repository (https://github.com/symfony/cache).
2327

24-
Key Concepts
25-
------------
28+
Cache (PSR-6) Versus Simple Cache (PSR-16)
29+
------------------------------------------
30+
31+
This component includes *two* different approaches to caching:
32+
33+
:ref:`PSR-6 Caching <cache-component-psr6-caching>`:
34+
A fully-featured cache system, which includes cache "pools", more advanced
35+
cache "items", and :ref:`cache tagging for invalidation <cache-component-tags>`.
36+
37+
:ref:`PSR-16 Simple Caching <cache-component-psr16-caching>`:
38+
A simple way to store, fetch and remove items from a cache.
39+
40+
Both methods support the *same* cache adapters and will give you very similar performance.
41+
42+
.. tip::
43+
44+
The component also contains adapters to convert between PSR-6 and PSR-16 caches.
45+
See :doc:`/components/cache/psr6_psr16_adapters`.
46+
47+
.. _cache-component-psr16-caching:
48+
49+
Simple Caching (PSR-16)
50+
-----------------------
51+
52+
This part of the component is an implementation of `PSR-16`_, which means that its
53+
basic API is the same as defined in the standard. First, create a cache object from
54+
one of the built-in cache classes. For example, to create a filesystem-based cache,
55+
instantiate :class:`Symfony\\Component\\Cache\\Simple\\FilesystemCache`::
56+
57+
use Symfony\Component\Cache\Simple\FilesystemCache;
58+
59+
$cache = new FilesystemCache();
60+
61+
Now you can create, retrieve, update and delete items using this object::
62+
63+
// save a new item in the cache
64+
$cache->set('stats.num_products', 4711);
65+
66+
// or set it with a custom ttl
67+
// $cache->set('stats.num_products', 4711, 3600);
68+
69+
// retrieve the cache item
70+
if (!$cache->has('stats.num_products')) {
71+
// ... item does not exists in the cache
72+
}
73+
74+
// retrieve the value stored by the item
75+
$numProducts = $cache->get('stats.num_products');
76+
77+
// or specify a default value, if the key doesn't exist
78+
// $numProducts = $cache->get('stats.num_products', 100);
79+
80+
// remove the cache key
81+
$cache->delete('stats.num_products');
82+
83+
// clear *all* cache keys
84+
$cache->clear();
85+
86+
You can also work with multiple items at once::
87+
88+
$cache->setMultiple(array(
89+
'stats.num_products' => 4711,
90+
'stats.num_users' => 1356,
91+
));
92+
93+
$stats = $cache->getMultiple(array(
94+
'stats.num_products',
95+
'stats.num_users',
96+
));
2697

27-
Before starting to use the Cache component, it's important that you learn the
28-
meaning of some key concepts:
98+
$cache->deleteMultiple(array(
99+
'stats.num_products',
100+
'stats.num_users',
101+
));
102+
103+
Available Simple Cache (PSR-16) Classes
104+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105+
106+
The following cache adapters are available:
107+
108+
.. tip::
109+
110+
To find out more about each of these classes, you can read the
111+
:doc:`PSR-6 Cache Pool </components/cache/cache_pools>` page. These "Simple"
112+
(PSR-16) cache classes aren't identical to the PSR-6 Adapters on that page, but
113+
each share constructor arguments and use-cases.
114+
115+
* :class:`Symfony\\Component\\Cache\\Simple\\ApcuCache`
116+
* :class:`Symfony\\Component\\Cache\\Simple\\ArrayCache`
117+
* :class:`Symfony\\Component\\Cache\\Simple\\ChainCache`
118+
* :class:`Symfony\\Component\\Cache\\Simple\\DoctrineCache`
119+
* :class:`Symfony\\Component\\Cache\\Simple\\FilesystemCache`
120+
* :class:`Symfony\\Component\\Cache\\Simple\\MemcachedCache`
121+
* :class:`Symfony\\Component\\Cache\\Simple\\NullCache`
122+
* :class:`Symfony\\Component\\Cache\\Simple\\PdoCache`
123+
* :class:`Symfony\\Component\\Cache\\Simple\\PhpArrayCache`
124+
* :class:`Symfony\\Component\\Cache\\Simple\\PhpFilesCache`
125+
* :class:`Symfony\\Component\\Cache\\Simple\\RedisCache`
126+
* :class:`Symfony\\Component\\Cache\\Simple\\TraceableCache`
127+
128+
.. _cache-component-psr6-caching:
129+
130+
More Advanced Caching (PSR-6)
131+
-----------------------------
132+
133+
To use the more-advanced, PSR-6 Caching abilities, you'll need to learn its key
134+
concepts:
29135

30136
**Item**
31137
A single unit of information stored as a key/value pair, where the key is
@@ -37,13 +143,13 @@ meaning of some key concepts:
37143
**Adapter**
38144
It implements the actual caching mechanism to store the information in the
39145
filesystem, in a database, etc. The component provides several ready to use
40-
adapters for common caching backends (Redis, APCu, etc.)
146+
adapters for common caching backends (Redis, APCu, Doctrine, PDO, etc.)
41147

42-
Basic Usage
43-
-----------
148+
Basic Usage (PSR-6)
149+
-------------------
44150

45-
This component is an implementation of `PSR-6`_, which means that its basic API
46-
is the same as defined in the standard. Before starting to cache information,
151+
This part of the component is an implementation of `PSR-6`_, which means that its
152+
basic API is the same as defined in the standard. Before starting to cache information,
47153
create the cache pool using any of the built-in adapters. For example, to create
48154
a filesystem-based cache, instantiate :class:`Symfony\\Component\\Cache\\Adapter\\FilesystemAdapter`::
49155

@@ -71,8 +177,10 @@ Now you can create, retrieve, update and delete items using this cache pool::
71177
// remove the cache item
72178
$cache->deleteItem('stats.num_products');
73179

74-
Advanced Usage
75-
--------------
180+
For a list of all of the supported adapters, see :doc:`/components/cache/cache_pools`.
181+
182+
Advanced Usage (PSR-6)
183+
----------------------
76184

77185
.. toctree::
78186
:glob:
@@ -81,4 +189,5 @@ Advanced Usage
81189
cache/*
82190

83191
.. _`PSR-6`: http://www.php-fig.org/psr/psr-6/
192+
.. _`PSR-16`: http://www.php-fig.org/psr/psr-16/
84193
.. _Packagist: https://packagist.org/packages/symfony/cache

components/cache/cache_invalidation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Cache Invalidation
77

88
Cache invalidation is the process of removing all cached items related to a
99
change in the state of your model. The most basic kind of invalidation is direct
10-
items deletion. But when the state of a primary resource has spread accross
10+
items deletion. But when the state of a primary resource has spread across
1111
several cached items, keeping them in sync can be difficult.
1212

1313
The Symfony Cache component provides two mechanisms to help solving this problem:

0 commit comments

Comments
 (0)