8000 Merge branch '3.0' · symfony/symfony-docs@f914049 · GitHub
[go: up one dir, main page]

Skip to content

Commit f914049

Browse files
committed
Merge branch '3.0'
2 parents 2e1bdc4 + f31a965 commit f914049

17 files changed

+148
-58
lines changed

book/forms.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ The CSRF token can be customized on a form-by-form basis. For example::
18101810
'csrf_protection' => true,
18111811
'csrf_field_name' => '_token',
18121812
// a unique key to help generate the secret token
1813-
'intention' => 'task_item',
1813+
'csrf_token_id' => 'task_item',
18141814
));
18151815
}
18161816

@@ -1826,8 +1826,12 @@ section.
18261826

18271827
.. note::
18281828

1829-
The ``intention`` option is optional but greatly enhances the security of
1830-
the generated token by making it different for each form.
1829+
The ``csrf_token_id`` option is optional but greatly enhances the security
1830+
of the generated token by making it different for each form.
1831+
1832+
.. versionadded:: 2.4
1833+
The ``csrf_token_id`` option was introduced in Symfony 2.4. Prior, you
1834+
had to use the ``intention`` option.
18311835

18321836
.. caution::
18331837

book/installation.rst

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
Installing and Configuring Symfony
55
==================================
66

7-
The goal of this chapter is to get you up and running with a working application
8-
built on top of Symfony. In order to simplify the process of creating new
9-
applications, Symfony provides an installer application.
7+
Welcome to Symfony! Starting a new Symfony project is easy. In fact, you'll have
8+
your first working Symfony application up and running in just a few short minutes.
9+
10+
.. seealso::
11+
12+
Do you prefer video tutorials? Check out the `Joyful Development with Symfony`_
13+
screencast series from KnpUniversity.
14+
15+
To make creating new applications even simpler, Symfony provides an installer.
16+
Downloading it is your first step.
1017

1118
Installing the Symfony Installer
1219
--------------------------------
@@ -220,10 +227,10 @@ If there are any issues, correct them now before moving on.
220227

221228
.. sidebar:: Setting up Permissions
222229

223-
One common issue when installing Symfony is that the ``var/cache`` and
224-
``var/logs`` directories must be writable both by the web server and the
225-
command line user. On a UNIX system, if your web server user is different
226-
from your command line user, you can try one of the following solutions.
230+
One common issue when installing Symfony is that the ``var`` directory must
231+
be writable both by the web server and the command line user. On a UNIX
232+
system, if your web server user is different from your command line user
233+
who owns the files, you can try one of the following solutions.
227234

228235
**1. Use the same user for the CLI and the web server**
229236

@@ -242,12 +249,11 @@ If there are any issues, correct them now before moving on.
242249

243250
.. code-block:: bash
244251
245-
$ rm -rf var/cache/*
246-
$ rm -rf var/logs/*
252+
$ rm -rf var/cache/* var/logs/* var/sessions/*
247253
248254
$ HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
249-
$ sudo chmod +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" var/cache var/logs
250-
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" var/cache var/logs
255+
$ sudo chmod +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" var
256+
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" var
251257
252258
253259
**3. Using ACL on a system that does not support chmod +a**
@@ -261,8 +267,8 @@ If there are any issues, correct them now before moving on.
261267
.. code-block:: bash
262268
263269
$ HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
264-
$ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var/cache var/logs
265-
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var/cache var/logs
270+
$ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
271+
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
266272
267273
If this doesn't work, try adding ``-n`` option.
268274

@@ -412,6 +418,7 @@ need in your new application.
412418
Be sure to also check out the :doc:`Cookbook </cookbook/index>`, which contains
413419
a wide variety of articles about solving specific problems with Symfony.
414420

421+
.. _`Joyful Development with Symfony`: http://knpuniversity.com/screencast/symfony
415422
.. _`explained in this post`: http://fabien.potencier.org/signing-project-releases.html
416423
.. _`Composer`: https://getcomposer.org/
417424
.. _`Composer download page`: https://getcomposer.org/download/

book/page_creation.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ simple two-step process:
2121
Just like on the web, every interaction is initiated by an HTTP request.
2222
Your job is pure and simple: understand that request and return a response.
2323

24+
.. seealso::
25+
26+
Do you prefer video tutorials? Check out the `Joyful Development with Symfony`_
27+
screencast series from KnpUniversity.
28+
2429
.. index::
2530
single: Page creation; Example
2631

@@ -585,6 +590,7 @@ There's also a :doc:`Cookbook </cookbook/index>` *packed* with more advanced
585590

586591
Have fun!
587592

593+
.. _`Joyful Development with Symfony`: http://knpuniversity.com/screencast/symfony/first-page
588594
.. _`app/Resources/views/base.html.twig`: https://github.com/symfony/symfony-standard/blob/2.7/app/Resources/views/base.html.twig
589595
.. _`Composer`: https://getcomposer.org
590596
.. _`find open source bundles`: http://knpbundles.com

components/dependency_injection/advanced.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,79 @@ You can change the inner service name if you want to:
219219
->setPublic(false)
220220
->setDecoratedService('foo', 'bar.wooz');
221221
222+
.. versionadded:: 2.8
223+
The ability to define the decoration priority was introduced in Symfony 2.8.
224+
Prior to Symfony 2.8, the priority depends on the order in
225+
which definitions are found.
226+
227+
If you want to apply more than one decorator to a service, you can control their
228+
order by configuring the priority of decoration, this can be any integer number
229+
(decorators with higher priorities will be applied first).
230+
231+
.. configuration-block::
232+
233+
.. code-block:: yaml
234+
235+
foo:
236+
class: Foo
237+
238+
bar:
239+
class: Bar
240+
public: false
241+
decorates: foo
242+
decoration_priority: 5
243+
arguments: ['@bar.inner']
244+
245+
baz:
246+
class: Baz
247+
public: false
248+
decorates: foo
249+
decoration_priority: 1
250+
arguments: ['@baz.inner']
251+
252+
.. code-block:: xml
253+
254+
<?xml version="1.0" encoding="UTF-8" ?>
255+
256+
<container xmlns="http://symfony.com/schema/dic/services"
257+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
258+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
259+
260+
<services>
261+
<service id="foo" class="Foo" />
262+
263+
<service id="bar" class="Bar" decorates="foo" decoration-priority="5" public="false">
264+
<argument type="service" id="bar.inner" />
265+
</service>
266+
267+
<service id="baz" class="Baz" decorates="foo" decoration-priority="1" public="false">
268+
<argument type="service" id="baz.inner" />
269+
</service>
270+
</services>
271+
</container>
272+
273+
.. code-block:: php
274+
275+
use Symfony\Component\DependencyInjection\Reference;
276+
277+
$container->register('foo', 'Foo')
278+
279+
$container->register('bar', 'Bar')
280+
->addArgument(new Reference('bar.inner'))
281+
->setPublic(false)
282+
->setDecoratedService('foo', null, 5);
283+
284+
$container->register('baz', 'Baz')
285+
->addArgument(new Reference('baz.inner'))
286+
->setPublic(false)
287+
->setDecoratedService('foo', null, 1);
288+
289+
The generated code will be the following:
290+
291+
.. code-block:: php
292+
293+
$this->services['foo'] = new Baz(new Bar(new Foo())));
294+
222295
Deprecating Services
223296
--------------------
224297

components/expression_language/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Expression Language
2-
===================
1+
ExpressionLanguage
2+
==================
33

44
.. toctree::
55
:maxdepth: 2

components/form/introduction.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ builder:
452452

453453
.. code-block:: php-standalone
454454
455+
use Symfony\Component\Form\Extension\Core\Type\FormType;
455456
use Symfony\Component\Form\Extension\Core\Type\TextType;
456457
use Symfony\Component\Form\Extension\Core\Type\DateType;
457458
@@ -461,7 +462,7 @@ builder:
461462
'dueDate' => new \DateTime('tomorrow'),
462463
);
463464
464-
$form = $formFactory->createBuilder('form', $defaults)
465+
$form = $formFactory->createBuilder(FormType::class, $defaults)
465466
->add('task', TextType::class)
466467
->add('dueDate', DateType::class)
467468
->getForm();

components/http_foundation/introduction.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,15 @@ exist::
151151

152152
When PHP imports the request query, it handles request parameters like
153153
``foo[bar]=bar`` in a special way as it creates an array. So you can get the
154-
``foo`` parameter and you will get back an array with a ``bar`` element. But
155-
sometimes, you might want to get the value for the "original" parameter name:
156-
``foo[bar]``. This is possible with all the ``ParameterBag`` getters like
157-
:method:`Symfony\\Component\\HttpFoundation\\Request::get` via the third
158-
argument::
154+
``foo`` parameter and you will get back an array with a ``bar`` element::
159155

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

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

165161
$request->query->get('foo[bar]');
166-
// returns null
167-
168-
$request->query->get('foo[bar]', null, true);
169-
// returns 'bar'
162+
// returns null
170163

171164
.. _component-foundation-attributes:
172165

cookbook/configuration/override_dir_structure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Override the ``cache`` Directory
3636
--------------------------------
3737

3838
You can change the default cache directory by overriding the ``getCacheDir`` method
39-
in the ``AppKernel`` class of you application::
39+
in the ``AppKernel`` class of your application::
4040

4141
// app/AppKernel.php
4242

cookbook/controller/upload_file.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ Then, add a new ``brochure`` field to the form that manages the ``Product`` enti
7676
'data_class' => 'AppBundle\Entity\Product',
7777
));
7878
}
79-
80-
public function getName()
81-
{
82-
return 'product';
83-
}
8479
}
8580

8681
Now, update the template that renders the form to display the new ``brochure``

cookbook/form/create_form_type_extension.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ by your extension.
7373
.. tip::
7474

7575
The value you return in the ``getExtendedType`` method corresponds
76-
to the value returned by the ``getName`` method in the form type class
77-
you wish to extend.
76+
to the fully qualified class name of the form type class you wish to
77+
extend.
7878

7979
In addition to the ``getExtendedType`` function, you will probably want
8080
to override one of the following methods:

cookbook/form/dynamic_form_modification.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ a bare form class looks like::
5757
'data_class' => 'AppBundle\Entity\Product'
5858
));
5959
}
60-
61-
public function getName()
62-
{
63-
return 'product';
64-
}
6560
}
6661

6762
.. note::

cookbook/form/form_customization.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ will be able to change the widget for each task as follows:
774774

775775
{% block _tasks_entry_widget %}
776776
<tr>
777-
<td>{{ form_widget(task.task) }}</td>
778-
<td>{{ form_widget(task.dueDate) }}</td>
777+
<td>{{ form_widget(form.task) }}</td>
778+
<td>{{ form_widget(form.dueDate) }}</td>
779779
</tr>
780780
{% endblock %}
781781

cookbook/profiler/data_collector.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ block and set the value of two variables called ``icon`` and ``text``:
160160
{% endset %}
161161

162162
{# the 'link' value set to 'false' means that this panel doesn't
163-
show a section in the web profiler (default is 'true'). #}
163+
show a section in the web profiler #}
164164
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: false }) }}
165165
{% endblock %}
166166

@@ -203,7 +203,7 @@ must also define additional blocks:
203203
</div>
204204
{% endset %}
205205

206-
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig') }}
206+
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': true }) }}
207207
{% endblock %}
208208

209209
{% block head %}

cookbook/security/acl_advanced.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ Security Identities
4545
This is analog to the object identity, but represents a user, or a role in
4646
your application. Each role, or user has its own security identity.
4747

48+
.. caution::
49+
50+
For users, the security identity is based on the username. This means that,
51+
if for any reason, a user's username was to change, you must ensure its
52+
security identity is updated too. The
53+
:method:`MutableAclProvider::updateUserSecurityIdentity() <Symfony\\Component\\Security\\Acl\\Dbal\\MutableAclProvider::updateUserSecurityIdentity>`
54+
method is there to handle the update.
55+
4856
Database Table Structure
4957
------------------------
5058

0 commit comments

Comments
 (0)
0