Skip to content

Commit 5052205

Browse files
committed
Merge branch '3.4'
* 3.4: (34 commits) Removed a deprecated feature in a testing article Some fixes for testing/* articles in 2.7 docs A few tiny encore tweaks Fixed some issues in PHPUnit XML config examples Minor typos in session articles Removed a wrong note about controllers as services Removed lots of redundant contents fix typo Update micro_kernel_trait.rst Update micro_kernel_trait.rst [#8650] Minor rewording [#8649] Small reword Improved the link to the Symfony events reference Minor fixes for upload_file.rst added commas for php code section [Workflow] minor tweaks Fixed a typo Fix minor typo Added getSubscribedEvents() to UserLocaleSubscriber [Config] Add missing paranthesis of `arrayPrototype` method ...
2 parents 36a933e + 196bbcd commit 5052205

File tree

19 files changed

+190
-194
lines changed

19 files changed

+190
-194
lines changed

components/config/definition.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ tree with ``append()``::
569569
->isRequired()
570570
->requiresAtLeastOneElement()
571571
->useAttributeAsKey('name')
572-
->arrayPrototype
572+
->arrayPrototype()
573573
->children()
574574
->scalarNode('value')->isRequired()->end()
575575
->end()

configuration/micro_kernel_trait.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ that define your bundles, your services and your routes:
9494
This is the same ``registerBundles()`` that you see in a normal kernel.
9595

9696
**configureContainer(ContainerBuilder $c, LoaderInterface $loader)**
97-
This methods builds and configures the container. In practice, you will use
97+
This method builds and configures the container. In practice, you will use
9898
``loadFromExtension`` to configure different bundles (this is the equivalent
9999
of what you see in a normal ``config.yml`` file). You can also register services
100100
directly in PHP or load external configuration files (shown below).

contributing/code/standards.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ Service Naming Conventions
222222
* Use lowercase letters for service and parameter names (except when referring
223223
to environment variables with the ``%env(VARIABLE_NAME)%`` syntax);
224224

225-
* A group name uses the underscore notation.
225+
* A group name uses the underscore notation;
226+
227+
* Add class aliases for public services (e.g. alias ``Symfony\Component\Something\ClassName``
228+
to ``something.service_name``).
226229

227230
Documentation
228231
-------------

doctrine.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ can automatically generate an empty ``test_project`` database for you:
184184
'dbal' => array(
185185
'charset' => 'utf8mb4',
186186
'default_table_options' => array(
187-
'charset' => 'utf8mb4'
188-
'collate' => 'utf8mb4_unicode_ci'
187+
'charset' => 'utf8mb4',
188+
'collate' => 'utf8mb4_unicode_ci',
189189
)
190190
),
191191
));

event_dispatcher.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ The most common way to listen to an event is to register an **event listener**::
6464

6565
Each event receives a slightly different type of ``$event`` object. For
6666
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`.
67-
To see what type of object each event listener receives, see :class:`Symfony\\Component\\HttpKernel\\KernelEvents`
68-
or the documentation about the specific event you're listening to.
67+
Check out the :doc:`Symfony events reference </reference/events>` to see
68+
what type of object each event provides.
6969

7070
Now that the class is created, you just need to register it as a service and
7171
notify Symfony that it is a "listener" on the ``kernel.exception`` event by

form/events.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Creating and binding an event listener to the form is very easy::
282282
return;
283283
}
284284

285-
// Check whether the user has chosen to display his email or not.
285+
// Check whether the user has chosen to display their email or not.
286286
// If the data was submitted previously, the additional value that is
287287
// included in the request variables needs to be removed.
288288
if (true === $user['show_email']) {
@@ -363,7 +363,7 @@ Event subscribers have different uses:
363363
$form = $event->getForm();
364364
365365
// Check whether the user from the initial data has chosen to
366-
// display his email or not.
366+
// display their email or not.
367367
if (true === $user->isShowEmail()) {
368368
$form->add('email', EmailType::class);
369369
}
@@ -378,7 +378,7 @@ Event subscribers have different uses:
378378
return;
379379
}
380380
381-
// Check whether the user has chosen to display his email or not.
381+
// Check whether the user has chosen to display their email or not.
382382
// If the data was submitted previously, the additional value that
383383
// is included in the request variables needs to be removed.
384384
if (true === $user['show_email']) {

frontend.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ to solve the most common Webpack use cases.
2525
Encore is made by `Symfony`_ and works *beautifully* in Symfony applications.
2626
But it can easily be used in any application... in any language!
2727

28+
.. _encore-toc:
29+
2830
Encore Documentation
2931
--------------------
3032

frontend/encore/simple-example.rst

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@ First Example
44
Imagine you have a simple project with one CSS and one JS file, organized into
55
an ``assets/`` directory:
66

7-
* ``assets/js/main.js``
8-
* ``assets/css/global.scss``
7+
* ``assets/js/app.js``
8+
* ``assets/css/app.scss``
99

10-
With Encore, we can easily minify these files, pre-process ``global.scss``
10+
With Encore, you should think of CSS as a *dependency* of your JavaScript. This means,
11+
you will *require* whatever CSS you need from inside JavaScript:
12+
13+
.. code-block:: javascript
14+
15+
// assets/js/app.js
16+
require('../css/app.scss');
17+
18+
// ...rest of JavaScript code here
19+
20+
With Encore, we can easily minify these files, pre-process ``app.scss``
1121
through Sass and a *lot* more.
1222

1323
Configuring Encore/Webpack
@@ -22,20 +32,14 @@ Inside, use Encore to help generate your Webpack configuration.
2232
var Encore = require('@symfony/webpack-encore');
2333
2434
Encore
25-
// directory where all compiled assets will be stored
35+
// the project directory where all compiled assets will be stored
2636
.setOutputPath('web/build/')
2737
28-
// what's the public path to this directory (relative to your project's document root dir)
38+
// the public path used by the web server to access the previous directory
2939
.setPublicPath('/build')
3040
31-
// empty the outputPath dir before each build
32-
.cleanupOutputBeforeBuild()
33-
34-
// will output as web/build/app.js
35-
.addEntry('app', './assets/js/main.js')
36-
37-
// will output as web/build/global.css
38-
.addStyleEntry('global', './assets/css/global.scss')
41+
// will create web/build/app.js and web/build/app.css
42+
.addEntry('app', './assets/js/app.js')
3943
4044
// allow sass/scss files to be processed
4145
.enableSassLoader()
@@ -45,6 +49,12 @@ Inside, use Encore to help generate your Webpack configuration.
4549
4650
.enableSourceMaps(!Encore.isProduction())
4751
52+
// empty the outputPath dir before each build
53+
.cleanupOutputBeforeBuild()
54+
55+
// show OS notifications when builds finish/fail
56+
.enableBuildNotifications()
57+
4858
// create hashed filenames (e.g. app.abc123.css)
4959
// .enableVersioning()
5060
;
@@ -83,7 +93,7 @@ Actually, to use ``enableSassLoader()``, you'll need to install a few
8393
more packages. But Encore will tell you *exactly* what you need.
8494

8595
After running one of these commands, you can now add ``script`` and ``link`` tags
86-
to the new, compiled assets (e.g. ``/build/global.css`` and ``/build/app.js``).
96+
to the new, compiled assets (e.g. ``/build/app.css`` and ``/build/app.js``).
8797
In Symfony, use the ``asset()`` helper:
8898

8999
.. code-block:: twig
@@ -93,7 +103,7 @@ In Symfony, use the ``asset()`` helper:
93103
<html>
94104
<head>
95105
<!-- ... -->
96-
<link rel="stylesheet" href="{{ asset('build/global.css') }}">
106+
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
97107
</head>
98108
<body>
99109
<!-- ... -->
@@ -124,7 +134,7 @@ Great! Use ``require()`` to import ``jquery`` and ``greet.js``:
124134

125135
.. code-block:: javascript
126136
127-
// assets/js/main.js
137+
// assets/js/app.js
128138
129139
// loads the jquery package from node_modules
130140
var $ = require('jquery');
@@ -139,34 +149,31 @@ Great! Use ``require()`` to import ``jquery`` and ``greet.js``:
139149
140150
That's it! When you build your assets, jQuery and ``greet.js`` will automatically
141151
be added to the output file (``app.js``). For common libraries like jQuery, you
142-
may want also to :doc:`create a shared entry </frontend/encore/shared-entry>` for better performance.
152+
may want to :doc:`create a shared entry </frontend/encore/shared-entry>` for better
153+
performance.
143154

144-
Requiring CSS Files from JavaScript
145-
-----------------------------------
155+
Multiple JavaScript Entries
156+
---------------------------
146157

147-
Above, you created an entry called ``app`` that pointed to ``main.js``:
158+
The previous example is the best way to deal with SPA (Single Page Applications)
159+
and very simple applications. However, as your app grows, you may want to have
160+
page-specific JavaScript or CSS (e.g. homepage, blog, store, etc.). To handle this,
161+
add a new "entry" for each page that needs custom JavaScript or CSS:
148162

149163
.. code-block:: javascript
150164
151165
Encore
152166
// ...
153-
.addEntry('app', './assets/js/main.js')
167+
.addEntry('homepage', './assets/js/homepage.js')
168+
.addEntry('blog', './assets/js/blog.js')
169+
.addEntry('store', './assets/js/store.js')
154170
;
155171
156-
Once inside ``main.js``, you can even require CSS files:
157-
158-
.. code-block:: javascript
159-
160-
// assets/js/main.js
161-
// ...
162-
163-
// a CSS file with the same name as the entry js will be output
164-
require('../css/main.scss');
165-
166-
Now, both an ``app.js`` **and** an ``app.css`` file will be created. You'll need
167-
to add a link tag to the ``app.css`` file in your templates:
172+
If those entries include CSS/Sass files (e.g. ``homepage.js`` requires
173+
``assets/css/homepage.scss``), two files will be generated for each:
174+
(e.g. ``build/homepage.js`` and ``build/homepage.css``).
168175

169-
.. code-block:: diff
176+
Keep Going!
177+
-----------
170178

171-
<link rel="stylesheet" href="{{ asset('build/global.css') }}">
172-
+ <link rel="stylesheet" href="{{ asset('build/app.css') }}">
179+
Go back to the :ref:`Encore Top List <encore-toc>` to learn more and add new features.

reference/configuration/framework.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Configuration
9898
* :ref:`enable_annotations <reference-validation-enable_annotations>`
9999
* `translation_domain`_
100100
* `strict_email`_
101-
* `mapping`_
101+
* :ref:`mapping <reference-validation-mapping>`
102102
* :ref:`paths <reference-validation-mapping-paths>`
103103
* `annotations`_
104104
* :ref:`cache <reference-annotations-cache>`
@@ -110,6 +110,8 @@ Configuration
110110
* :ref:`enable_annotations <reference-serializer-enable_annotations>`
111111
* :ref:`name_converter <reference-serializer-name_converter>`
112112
* :ref:`circular_reference_handler <reference-serializer-circular_reference_handler>`
113+
* :ref:`mapping <reference-serializer-mapping>`
114+
* :ref:`paths <reference-serializer-mapping-paths>`
113115
* `php_errors`_
114116
* `log`_
115117
* `throw`_
@@ -1591,6 +1593,8 @@ If this option is enabled, the `egulias/email-validator`_ library will be
15911593
used by the :doc:`/reference/constraints/Email` constraint validator. Otherwise,
15921594
the validator uses a simple regular expression to validate email addresses.
15931595

1596+
.. _reference-validation-mapping:
1597+
15941598
mapping
15951599
.......
15961600

@@ -1716,6 +1720,21 @@ method.
17161720
For more information, see
17171721
:ref:`component-serializer-handling-circular-references`.
17181722

1723+
.. _reference-serializer-mapping:
1724+
1725+
mapping
1726+
.......
1727+
1728+
.. _reference-serializer-mapping-paths:
1729+
1730+
paths
1731+
"""""
1732+
1733+
**type**: ``array`` **default**: ``[]``
1734+
1735+
This option allows to define an array of paths with files or directories where
1736+
the component will look for additional serialization files.
1737+
17191738
php_errors
17201739
~~~~~~~~~~
17211740

reference/configuration/security.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ dn_string
462462
**type**: ``string`` **default**: ``{username}``
463463

464464
This is the string which will be used as the bind DN. The ``{username}``
465-
placeholder will be replaced with the user-provided value (his login).
465+
placeholder will be replaced with the user-provided value (their login).
466466
Depending on your LDAP server's configuration, you may need to override
467467
this value.
468468

reference/configuration/twig.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ TwigBundle Configuration ("twig")
5858
paths:
5959
'%kernel.project_dir%/vendor/acme/foo-bar/templates': foo_bar
6060
61-
# The following were added in Symfony 2.7.
6261
date:
6362
format: d.m.Y, H:i:s
6463
interval_format: '%%d days'

reference/dic_tags.rst

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
The Dependency Injection Tags
1+
Built-in Symfony Service Tags
22
=============================
33

4-
Dependency Injection Tags are little strings that can be applied to a service
5-
to "flag" it to be used in some special way. For example, if you have a
6-
service that you would like to register as a listener to one of Symfony's
7-
core events, you can flag it with the ``kernel.event_listener`` tag.
4+
:doc:`Service tags </service_container/tags>` are the mechanism used by the
5+
:doc:`DependencyInjection component </components/dependency_injection>` to flag
6+
services that require special processing, like console commands or Twig extensions.
87

9-
You can learn a little bit more about "tags" by reading the ":doc:`/service_container/tags`"
10-
article.
11-
12-
Below is information about all of the tags available inside Symfony. There
13-
may also be tags in other bundles you use that aren't listed here.
8+
These are the most common tags provided by Symfony components, but in your
9+
application there could be more tags available provided by third-party bundles:
1410

1511
======================================== ========================================================================
1612
Tag Name Usage

0 commit comments

Comments
 (0)