Skip to content

Commit 81645f9

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: (23 commits) Fix YAML identation Update rendering.rst Update formatter.rst remove part about adding extension Add "allowed_classes" argument for unserialize() Removed another unneeded closing block name Fix little typo Fix "class_exists" PHP function URL add missing ";" Remove faulty PHP code blocks Fix typo in method setETag. Correct method name is setEtag Changes after code review Changes after code review Changes after code review Minor changes to the previous merge Rewrite the gender-neutral pronoun section to reflect an inclusive viewpoint for everyone Replace jQuery example with plain JavaScript Update controller.rst Add cautionary advice about SQL reserved words Fix "JsonSerializable" URL ...
2 parents 67d3377 + 44f2402 commit 81645f9

File tree

13 files changed

+41
-90
lines changed

13 files changed

+41
-90
lines changed

components/cache/psr6_psr16_adapters.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ instead. No problem! The Cache component provides the
3737
this use-case::
3838

3939
use Symfony\Component\Cache\Simple\FilesystemCache;
40-
use Symfony\Component\Cache\Adapter\SimpleCacheAdapter
40+
use Symfony\Component\Cache\Adapter\SimpleCacheAdapter;
4141

4242
// the PSR-16 cache object that you want to use
4343
$psr16Cache = new FilesystemCache();

contributing/community/review-comments.rst

+10-8
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,18 @@ that, but swearing/cursing and name calling doesn't really encourage anyone to
4343
help you. Take a deep breath, count to 10 and try to *clearly* explain what problems
4444
you encounter.
4545

46-
Gender-neutral Pronouns
47-
-----------------------
46+
Inclusive Language
47+
------------------
4848

49-
While not "formally" required, it's better to use gender-neutral pronouns.
50-
Unless someone "indicated" their pronouns, use "they", "them" instead of
51-
"he", "she", "his", "hers", "his/hers", "he/she", etc.
49+
In an effort to be inclusive to a wide group of people, it's recommended to
50+
use personal pronouns that don't suggest a particular gender. Unless someone
51+
has stated their pronouns, use "they", "them" instead of "he", "she", "his",
52+
"hers", "his/hers", "he/she", etc.
5253

53-
Try to avoid using wording that may be considered excluding and needlessly gendered,
54-
like for example words that have a male base. For example we recommend to use other
55-
words like "folks", "team", "everyone" in place of "guys".
54+
Try to avoid using wording that may be considered excluding, needlessly gendered
55+
(e.g. words that have a male or female base), racially motivated or singles out
56+
a particular group in society. For example, it's recommended to use words like
57+
"folks", "team", "everyone" instead of "guys", "ladies", "yanks", etc.
5658

5759
Giving Positive Feedback
5860
------------------------

controller.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ method renders a template **and** puts that content into a ``Response``
182182
object for you::
183183

184184
// renders templates/lucky/number.html.twig
185-
return $this->render('lucky/number.html.twig', array('name' => $name));
185+
return $this->render('lucky/number.html.twig', array('number' => $number));
186186

187187
Templating and Twig are explained more in the
188188
:doc:`Creating and Using Templates article </templating>`.

form/rendering.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ of code. Of course, you'll usually need much more flexibility when rendering:
2121

2222
.. code-block:: html+php
2323

24-
<!-- templates/default/newAction.html.php -->
24+
<!-- templates/default/new.html.php -->
2525
<?php echo $view['form']->start($form) ?>
2626
<?php echo $view['form']->errors($form) ?>
2727

frontend/encore/server-data.rst

+12-5
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ Fetch this in JavaScript:
1616

1717
.. code-block:: javascript
1818
19-
// jquery isn't required, but makes things simple
20-
var $ = require('jquery');
21-
22-
$(document).ready(function() {
23-
var isAuthenticated = $('.js-user-rating').data('is-authenticated');
19+
document.addEventListener('DOMContentLoaded', function() {
20+
var userRating = document.querySelector('.js-user-rating');
21+
var isAuthenticated = userRating.dataset.isAuthenticated;
2422
});
2523
24+
.. note::
25+
26+
When `accessing data attributes from JavaScript`_, the attribute names are
27+
converted from dash-style to camelCase. For example, ``data-is-authenticated``
28+
becomes ``isAuthenticated`` and ``data-number-of-reviews`` becomes
29+
``numberOfReviews``.
30+
2631
There is no size limit for the value of the ``data-`` attributes, so you can
2732
store any content. In Twig, use the ``html_attr`` escaping strategy to avoid messing
2833
with HTML attributes. For example, if your ``User`` object has some ``getProfileData()``
@@ -33,3 +38,5 @@ method that returns an array, you could do the following:
3338
<div data-user-profile="{{ app.user ? app.user.profileData|json_encode|e('html_attr') : '' }}">
3439
<!-- ... -->
3540
</div>
41+
42+
.. _`accessing data attributes from JavaScript`: https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes

http_cache/validation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ exposing a simple and efficient pattern::
200200

201201
// create a Response with an ETag and/or a Last-Modified header
202202
$response = new Response();
203-
$response->setETag($article->computeETag());
203+
$response->setEtag($article->computeETag());
204204
$response->setLastModified($article->getPublishedAt());
205205

206206
// Set response as public. Otherwise it will be private by default.

logging/formatter.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ configure your handler to use it:
6868
'file' => array(
6969
'type' => 'stream',
7070
'level' => 'debug',
71-
'formatter' => JsonFormatter::class',
71+
'formatter' => JsonFormatter::class,
7272
),
7373
),
7474
));

routing.rst

-4
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,6 @@ a slash. URLs matching this route might look like:
468468
Symfony provides you with a way to do this by leveraging service container
469469
parameters. Read more about this in ":doc:`/routing/service_container_parameters`".
470470

471-
.. caution::
472-
473-
A route placeholder name cannot start with a digit and cannot be longer than 32 characters.
474-
475471
Special Routing Parameters
476472
~~~~~~~~~~~~~~~~~~~~~~~~~~
477473

security/entity_provider.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,20 @@ with the following fields: ``id``, ``username``, ``password``,
130130
$this->password,
131131
// see section on salt below
132132
// $this->salt
133-
) = unserialize($serialized);
133+
) = unserialize($serialized, ['allowed_classes' => false]);
134134
}
135135
}
136136

137137
To make things shorter, some of the getter and setter methods aren't shown.
138138
But you can generate these manually or with your own IDE.
139139

140+
.. caution::
141+
142+
In the example above, the User entity's table name is "app_users" because
143+
"USER" is a SQL reserved word. If you wish to call your table name "user",
144+
`it must be quoted with backticks`_ to avoid errors. The annotation should
145+
look like ``@ORM\Table(name="`user`")``.
146+
140147
Next, make sure to :ref:`create the database table <doctrine-creating-the-database-tables-schema>`:
141148

142149
.. code-block:: terminal
@@ -539,3 +546,4 @@ or worry about it.
539546

540547
.. _fixtures: https://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html
541548
.. _FOSUserBundle: https://github.com/FriendsOfSymfony/FOSUserBundle
549+
.. _`it must be quoted with backticks`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#quoting-reserved-words

serializer.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ As well as the following normalizers:
5858
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer` to
5959
handle typical data objects
6060
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` for
61-
objects implementing the :class:`DateTimeInterface` interface
61+
objects implementing the :phpclass:`DateTimeInterface` interface
6262
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DataUriNormalizer` to
63-
transform :class:`SplFileInfo` objects in `Data URIs`_
63+
transform :phpclass:`SplFileInfo` objects in `Data URIs`_
6464
* :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer`
65-
to deal with objects implementing the :class:`JsonSerializable` interface
65+
to deal with objects implementing the :phpclass:`JsonSerializable` interface
6666
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` to
6767
denormalize arrays of objects using a format like `MyObject[]` (note the `[]` suffix)
6868

service_container/3.3-di-changes.rst

-54
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,6 @@ what the file looks like in Symfony 4):
8181
</services>
8282
</container>
8383
84-
.. code-block:: php
85-
86-
// config/services.php
87-
use Symfony\Component\DependencyInjection\Definition;
88-
89-
// To use as default template
90-
$definition = new Definition();
91-
92-
$definition
93-
->setAutowired(true)
94-
->setAutoconfigured(true)
95-
->setPublic(false)
96-
;
97-
98-
$this->registerClasses($definition, 'App\\', '../src/*', '../src/{Entity,Migrations,Tests}');
99-
100-
// Changes default config
101-
$definition
102-
->addTag('controller.service_arguments')
103-
;
104-
105-
// $this is a reference to the current loader
106-
$this->registerClasses($definition, 'App\\Controller\\', '../src/Controller/*');
107-
108-
// add more services, or override services that need manual wiring
109-
11084
This small bit of configuration contains a paradigm shift of how services
11185
are configured in Symfony.
11286

@@ -152,22 +126,6 @@ thanks to the following config:
152126
</services>
153127
</container>
154128
155-
.. code-block:: php
156-
157-
// config/services.php
158-
use Symfony\Component\DependencyInjection\Definition;
159-
160-
// To use as default template
161-
$definition = new Definition();
162-
163-
$definition
164-
->setAutowired(true)
165-
->setAutoconfigured(true)
166-
->setPublic(false)
167-
;
168-
169-
$this->registerClasses($definition, 'App\\', '../src/*', '../src/{Entity,Migrations,Tests}');
170-
171129
This means that every class in ``src/`` is *available* to be used as a
172130
service. And thanks to the ``_defaults`` section at the top of the file, all of
173131
these services are **autowired** and **private** (i.e. ``public: false``).
@@ -504,18 +462,6 @@ inherited from an abstract definition:
504462
</services>
505463
</container>
506464
507-
.. code-block:: php
508-
509-
// config/services.php
510-
use App\Domain\LoaderInterface;
511-
512-
// ...
513-
514-
/* This method returns a child definition to define the default
515-
configuration of the given class or interface */
516-
$container->registerForAutoconfiguration(LoaderInterface::class)
517-
->addTag('app.domain_loader');
518-
519465
What about Performance
520466
----------------------
521467

service_container/lazy_services.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ You can mark the service as ``lazy`` by manipulating its definition:
5353
5454
# config/services.yaml
5555
services:
56-
App\Twig\AppExtension:
57-
lazy: true
56+
App\Twig\AppExtension:
57+
lazy: true
5858
5959
.. code-block:: xml
6060

validation.rst

-8
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,6 @@ of the form fields::
513513
;
514514
}
515515

516-
The ``constraints`` option is only available if the ``ValidatorExtension``
517-
was enabled through the form factory builder::
518-
519-
Forms::createFormFactoryBuilder()
520-
->addExtension(new ValidatorExtension(Validation::createValidator()))
521-
->getFormFactory()
522-
;
523-
524516
.. index::
525517
single: Validation; Constraint targets
526518

0 commit comments

Comments
 (0)